Docs
Node Operation
Node Monitoring
Grafana Dashboard

Grafana Setup

The following is a guide outlining the steps to setup Grafana Dashboard to visualize metric data for a Tangle node. If you do not have Tangle node setup yet, please review the Tangle Node Quickstart setup guide here.

In this guide we will configure the following modules to visualize metric data from a running Tangle node.

  • Grafana is the visual dashboard tool that we access from the outside (through SSH tunnel to keep the node secure).

What are Grafana Dashboards?

A dashboard is a set of one or more panels organized and arranged into one or more rows. Grafana ships with a variety of panels making it easy to construct the right queries, and customize the visualization so that you can create the perfect dashboard for your need. Each panel can interact with data from any configured Grafana data source. To learn more about Grafana Dashboards, please visit the official docs site here (opens in a new tab).

Getting Started

Let's first start by downloading the latest releases of the above mentioned modules (Grafana).

This guide assumes the user has root access to the machine running the Tangle node, and following the below steps inside that machine. As well as, the user has already configured Prometheus on this machine.

1. Download Grafana

brew
brew update
brew install grafana

2. Add Grafana repository to APT sources:

This guide assumes the user is installing and configuring Grafana for a linux machine. For Macos instructions please visit the offical docs here (opens in a new tab).

add-apt
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

3. Refresh your APT cache to update your package lists:

apt update
sudo apt update

4. Next, make sure Grafana will be installed from the Grafana repository:

apt-cache
apt-cache policy grafana

The output of the previous command tells you the version of Grafana that you are about to install, and where you will retrieve the package from. Verify that the installation candidate at the top of the list will come from the official Grafana repository at https://packages.grafana.com/oss/deb.

output
Output of apt-cache policy grafana
grafana:
  Installed: (none)
  Candidate: 6.3.3
  Version table:
     6.3.3 500
        500 https://packages.grafana.com/oss/deb stable/main amd64 Packages
...

5. You can now proceed with the installation:

install grafana
sudo apt install grafana

6. Install the Alert manager plugin for Grafana:

grafana-cli
sudo grafana-cli plugins install camptocamp-prometheus-alertmanager-datasource

Service Setup

Grafana

The Grafana’s service is automatically created during extraction of the deb package, you do not need to create it manually.

Launch a daemon reload to take the services into account in systemd:

daemon-reload
sudo systemctl daemon-reload

Start the Grafana service:

start service
sudo systemctl start grafana-server

And check that they are working fine, one by one:

status
systemctl status grafana-server

If everything is working adequately, activate the services!

enable
sudo systemctl enable grafana-server

Run Grafana dashboard

Now we are going to setup the dashboard to visiualize the metrics we are capturing.

From the browser on your local machine, navigate to http://localhost:3000/login. You should be greeted with a login screen. You can login with the default credentials, admin/admin. Be sure to update your password afterwards.

This guide assumes the user has configured Prometheus, AlertManager, and Loki as a data source.

Next, we need to add Prometheus as a data source.

  1. Open the Settings menu
  2. Select Data Sources
  3. Select Add Data Source
  4. Select Prometheus
  5. Input the URL field with http://localhost:9090 (opens in a new tab)
  6. Click Save & Test

Next, we need to add AlertManager as a data source.

  1. Open the Settings menu
  2. Select Data Sources
  3. Select Add Data Source
  4. Select AlertManager
  5. Input the URL field with http://localhost:9093 (opens in a new tab)
  6. Click Save & Test

Next, we need to add Loki as a data source.

  1. Open the Settings menu
  2. Select Data Sources
  3. Select Add Data Source
  4. Select Loki
  5. Input the URL field with http://localhost:3100 (opens in a new tab)
  6. Click Save & Test

We have our data sources connected, now its time to import the dashboard we want to use. You may create your own or import others, but the purposes of this guide we will use the Polkadot Essentials dashboard created by bLD nodes!

To import a dashboard:

  1. Select the + button
  2. Select Import
  3. Input the dashboard number, 13840
  4. Select Prometheus and AlertManager as data sources from the dropdown menu
  5. Click Load

In the dashboard selection, make sure you select:

  • Chain Metrics: substrate
  • Chain Instance Host: localhost:9615 to point the chain data scrapper
  • Chain Process Name: the name of your node binary

Congratulations!! You have now configured Grafana to visualize the metrics we are capturing. You now have monitoring setup for your node!