Monitor nodes Kusama, Polkadot & Substrate, with Grafana
Hello, people from Crypto, we are going to build a Kusama node based on Polkadot software that is in turn based on Substrate and we are going to take the metrics of the node with Grafana because the Substrate software is now plug and play with Grafana.
This means that from these new versions of Substrate-based software you will be able to monitor your nodes from Polkadot, Kusama, Edgeware, and those that come. 🚀
First, let’s start with the installation of Kusama, software from
Let’s update the operating system and install tools
sudo apt update && sudo apt upgrade -y && sudo apt install make clang pkg-config libssl-dev build-essential
curl https://sh.rustup.rs -sSf | sh
git clone https://github.com/paritytech/polkadot.gitcd polkadotgit checkout v0.7.3./scripts/init.shcargo build --release
This step takes time to be done.
Synchronize Kusama CC3
Kusama CC3 →Telemetry explorer last block
Start to sync the last block like
./target/release/polkadot --name write-node-name-here #If your plan is validate or run one sentry node start the node like this./target/release/polkadot --name write-node-name-here --pruning archive
Check your correct version of Grafana and download according to your operating system
here Ubuntu 18.04
Go to the download page for the latest download links.
sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_6.5.1_amd64.deb
sudo service grafana-server start
Start Grafana via systemd
systemctl start grafana-server
systemctl status grafana-server
Enable the systemd service so that Grafana starts at boot.
sudo systemctl enable grafana-server.service
The configuration file is located at
/etc/grafana/grafana.ini. Go to the Configuration page for details on all those options.
NOTE: No need to change any setup for one basic setup.
Adding data sources
JSON Datasource — a generic backend datasource
The JSON Datasource executes JSON requests against arbitrary backends.
JSON Datasource is built on top of the Simple JSON Datasource. It has refactored code, additional features and active development.
To install this plugin using the
grafana-cli plugins install simpod-json-datasource
#✔ Installed simpod-json-datasource successfully
we need to restart Grafana for the JSON Datasource can work.
sudo systemctl restart grafana-server
#or depends your setup
sudo service grafana-server restart
Starting the node to interact with Grafana
If we already have the Kusama node synchronized the last block we can proceed to the final configuration to take the metrics in real-time
if we review the help of the Kusama node we can see the options for Grafana among the other configurations options.
./target/release/polkadot -h#--grafana-external → Listen to all Grafana data source interfaces ←
#--grafana-port → Specify Grafana data source server TCP Port ←
We stop the CRTL + c node and proceed to start it again but with the options for Datasource
./target/release/polkadot --name write-node-name-here --pruning archive --grafana-external --grafana-port 9966
9955 is the default port if not used the --grafana-port option, remember you can use the port you want as long as you take note of what it is for the connection time.
Now we have the Kusama server running on a VPS or Dedicated server and we want to take the metrics from our Browser in the laptop or office, we must have the ports of Grafana 3000 and the JSON Datasource open 9966 in our case here on this guide, remember the 2 Ports you can choose them under your own taste.
Open your browser in the IP from the where is the server we just configured, with the port like this
default username & password: admin
If everything went well you can see here your JSON Datasource installed too
The first thing we are going to do is configure the Datasource
This is the one we install on our server and with which we are interested in interacting.
Save & Test =
very well, arrived here now we just have to create our dashboard and add the metrics that we like
In this tutorial we are going to create a dashboard and add you to measure the last block and the best finished, the use of the CPU, memory, input and output broadband
Setup first Panel Blocks in 3 steps
Time series to rows
Add two QUERIES
General: add Title
First Panel finished, Save and Go back for add another Panel in the dashboard.
If going well Your node configured in the panel and the node in telemetry or in your logs must correspond to the last block, either one below or one above.
In this case, the node configured in Grafana is the same one that is configured in Telemetry as “The validator” and the last blocks correspond perfectly.
Note: when the last block is delayed by a block is ok, it is by the refresh rate of every 5 seconds, so it is normal to see this difference.
Panel for bandwidth up / down
Queries: add 2
Setup at your taste and Save for back to add another Panel
here is a good time for CPU use your most nice improvement and go on,
Now Memory time
→ Panel for TX count
After play around and open one for peers too, This is my Grafana Kusama Sentry “The Validator” Dashboard
With a little practice like Grafana, it is intuitive and fun to make some practical and useful dashboards for tracking your servers in Blockchain.
Collaborate with melea, nominating our validators or with a tip.
#Kusama account $KSM → tip