CPU Monitor Dashboard for Ark Bridgechain Relay

During development of our Relay@Home project we created a CPU monitor dashboard using Grafana so that we could evaluate the performance of the Raspberry Pi. This guide shows a modified version of the dashboard that can be setup on any Ark Bridgechain Relay running on a VPS. This could be useful tool for network operators.

Live Dashboard running on one of our Ark Relays: https://grafana.littleyus.com/d/sF7d-FHZz/relay-cpu-monitor

Screenshot of dashboard

Table of Contents

    Software Installation

    The visualization suite is comprised of three open source software applications:

    • InfluxDB is an open-source time series database.
    • Telegraf is an agent for collecting metrics from systems.
    • Grafana is an open source data visualization tool.

    Add Repositories

    InfluxDB Ubuntu 18.04

    • echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
    • sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -

    InfluxDB Ubuntu 20.04/21.04

    • echo "deb https://repos.influxdata.com/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
    • sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -

    Grafana 18.04/20.04/21.04

    • sudo apt-get install -y apt-transport-https
    • sudo apt-get install -y software-properties-common wget
    • wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
    • echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list


    Install Grafana, InfluxDB and Telegraf

    • sudo apt-get update
    • sudo apt-get install -y grafana influxdb telegraf

    Enable services

    • sudo systemctl enable influxdb grafana-server telegraf
    • sudo systemctl start influxdb grafana-server telegraf

    The successful start can be verified via:

    • sudo systemctl status telegraf.service
    • sudo systemctl status influxdb.service
    • sudo systemctl status grafana-server.service


    Configure InfluxDB

    We are going to create a database with the following parameters:

    • database name: telegraf
    • Database retention: four weeks
    • user: telegrafuser
    • password: telegrafpassword23

    Start Influx CLI:

    Create database
    > create database telegraf
    > use telegraf
    > create user telegrafuser with password 'telegrafpassword23' with all privileges
    > grant all privileges on telegraf to telegrafuser
    > create retention policy "4Weeks" on "telegraf" duration 4w replication 1 default
    > exit

    Configure Telegraf

    Open Telegraf configuration file
    sudo nano /etc/telegraf/telegraf.conf

    To send local agent data to InfluxDB, uncomment and/or alter the following sections of the central Telegraf configuration file.

       urls = [""]
    ## For UDP url endpoint database needs to be configured on server side. 
     database = "telegraf"
    ## HTTP Basic Auth  
       username = "telegrafuser"
       password = "telegrafpassword23"

    To complement the default Telegraf configuration we will add a few more parameters to monitor by creating a new custom configuration file.

    create and open file:
    sudo nano /etc/telegraf/telegraf.d/relay.conf

    Copy the following to the file:


    Reload Telegraf Service
    sudo systemctl reload telegraf.service

    Check the status of the service for errors
    sudo systemctl status telegraf.service

    Check that data is being written to database
    Start Influx CLI
    sudo influx
    Select Database
    > use telegraf
    Display measurements stored in Database
    > show measurements
    You should see the following result:

    name: measurements

    Display the last 5 data points from “system” measurement:
    > select * from system limit 5

    You should see results similar to the following:

    name: system
    time                host                   load1 load15 load5 n_cpus n_users uptime uptime_format
    ----                ----                   ----- ------ ----- ------ ------- ------ -------------
    1618891060000000000 Ubuntu18-DashboardTest 0.16  0.15   0.29  1      1       359     0:05
    1618891070000000000 Ubuntu18-DashboardTest 0.13  0.15   0.28  1      1       369     0:06
    1618891080000000000 Ubuntu18-DashboardTest 0.11  0.15   0.27  1      1       379     0:06
    1618891090000000000 Ubuntu18-DashboardTest 0.09  0.15   0.26  1      1       389     0:06
    1618891100000000000 Ubuntu18-DashboardTest 0.08  0.14   0.26  1      1       399     0:06

    Configure Grafana

    Add JSON API data source plugin
    sudo grafana-cli plugins install marcusolsson-json-datasource
    Reload Grafana Service
    sudo systemctl restart grafana-server

    It is assumed that UFW is being used as your firewall. Open port on firewall
    sudo ufw allow 3000

    Open the following URL in your webbrowser to reach the login screen: http://your_IP_address:3000

    Default Login info is:
    username: admin
    password: admin

    It will immediately ask you to change the password.

    Add InfluxDB as a data source

    menu: Configuration->Data Sources
    Select: “Add data source”
    Select: ‘InfluxDB”

    Configure the following parameters
    Name: InfluxDB
    URL = http://localhost:8086
    Database: telegraf
    User: telegrafuser
    Password: telegrafpassword23
    HTTP Method: GET

    Press “Save & Test”: You should get message that says “Data source is working”

    Add JSON API as a data source

    menu: Configuration->Data Sources
    Select: “Add data source”
    Select: ‘JSON API”

    Configure the following parameters (Change the API port number specific to your chain)
    Name: JSON API Local
    URL =

    Add Dashboard

    Download Reference CPU Monitor Dashboard:

    menu: Dashboard->Manage
    Select: Import
    Select: Upload JSON file
    Upload the JSON file previously downloaded.
    Select “InfluxDB” and “JSON API Local” as the data sources.

    Set as your default home dashboard

    menu: Dashboards->Home
    Under “Recently viewed dashboards” you will see the new dashboard you created. Star it.

    menu: Configuration->Preferences
    You can select the new dashboard as the “Home Dashboard”
    Now the CPU monitor dashboard will load immediately when logging in.

    Configure Grafana Dashboards to be viewable by public without login (OPTIONAL)

    By default Grafana is configured so that you need to be logged in to edit or view dashboards. Often I want dashboards to be viewable by others without a login.

    1. Make Grafana dashboard public without login. Edit Grafana config file
      nano /etc/grafana/grafana.ini
    2. in the [auth.anonymous] section make the following changes.
    # enable anonymous access
    enabled = true
    # specify organization name that should be used for unauthenticated users
    org_name = Main Org.
    # specify role for unauthenticated users
    org_role = Viewer
    1. Restart Grafana
      service grafana-server restart