Monitor nodes Kusama, Polkadot & Substrate, with Grafana

https://kusama.network/

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. 🚀

Grafana metrics
Kusama Grafana 2 sentrys Nodes
Jazz if you like some for the build.

First, let’s start with the installation of Kusama, software from

https://www.parity.io/

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

Install rust

curl https://sh.rustup.rs -sSf | sh

Installing Kusama

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.

2 Cores 8 Ram = 73 minutes

More about Kusama Node
How to → Validate / Nominate

Synchronize Kusama CC3

Kusama CC3 →Telemetry explorer last block

Start to sync the last block like

cd polkadot
./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

Grafana Time

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.

wget https://dl.grafana.com/oss/release/grafana_6.5.1_amd64.deb
sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_6.5.1_amd64.deb

Start Grafana

sudo service grafana-server start

Start Grafana via systemd

systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server

Enable the systemd service so that Grafana starts at boot.

sudo systemctl enable grafana-server.service

Configuration

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.

https://grafana.com/grafana/plugins/simpod-json-datasource

Installation

To install this plugin using the grafana-cli tool:

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

Melea Kusama Dashboard at the end of this guide here

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.

2019–12–03 00:25:09 Grafana data source server started at 0.0.0.0:9966

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

11.111.111.11:3000

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

Click here

This is the one we install on our server and with which we are interested in interacting.

Setup VPS IP and Datasource port

Save & Test =

Data source is working

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

Visualization: Table

Time series to rows

Queries

Select your JSON DATASOURCE from the VPS

Add two QUERIES

  • height
  • finalized_height
Time block on the Panel→ more time = more blocks
Save Dashboard time to time

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

Add +Panel

Visualization: Graph

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.

Have fun!

https://meleatrust.com/kusama/

Collaborate with melea, nominating our validators or with a tip.

#Kusama account $KSM → tip

DMELEokhPzoNDxYNpNPCfEoLs3BEYX297aE733Nzo3UAtVq

Ahoy!

https://meleatrust.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

ALEO , 9 MARCH!

Still Waiting to Use Docker for Your Project!

Some people might take interest Some may support you in your quest.

The shadowy area of web scraping: 7 of the best web scraping tools

Morgan Stanley Interview experience (Off-campus for Summer 2021 Internship)

Convenient way to read a file resource into Java unit test

Streaming Android Camera using OpenCV | Analytics Steps

How to check version of your spring application on production

Get the Medium app

Víctor | melea

Víctor | melea

https://meleatrust.com/

More from Medium

How to stake Persistence in Cosmostation with JECO

MyHbarWallet Announces Calaxy Token ($CLXY) Support

ALL ABOUT ALNAIR FINANCE

BenJ Update #5