Introduction

Monitoring your node’s performance in real time allows you to ensure that it is running smoothly and efficiently. The go-quai client bundles a monitoring solution that allows you to track the health and performance of your node. This guide will walk you through setting up Grafana and Prometheus to monitor your node.

Prerequisites

Quai Network NodeA Quai Network node to enable monitoring for.
GrafanaAn open-source analytics and monitoring solution.
PrometheusAn open-source monitoring and alerting toolkit.

Install Dependencies

If you are configuring monitoring for an external node, you will need to forward the Prometheus and Grafana ports to your local machine. Grafana runs on port 3000, and Prometheus runs on port 9090 by default.

Prometheus

Installing Prometheus can be done from the command line using your favorite package manager. Run the following command to install Prometheus on a Linux machine:

sudo apt install prometheus -y

On first install, it can be useful to enable the Prometheus service to start on boot. This will prevent you from having to manually start the service every time you reboot your machine. To enable the Prometheus service, run the following command:

sudo systemctl enable prometheus

Grafana

You can install Grafana by following the instructions on the official Grafana download page.

For example, on Ubuntu, you can install Grafana using the following commands:

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

Configuration

Prometheus requires a configuration file to scrape metrics from your node. go-quai has a pre-configured Prometheus configuration file that you can use. To use this configuration file, navigate to the go-quai directory and run the following command:

cp metrics_config/prometheus.yml /etc/prometheus/

You only need to copy the configuration file once. If you have already copied the file, you do not need to run the command again.

Initialize Node Monitoring

To start monitoring your node, you’ll need to ensure that both Prometheus and Grafana are running. You can start both services using the following commands:

sudo systemctl start prometheus
sudo systemctl start grafana-server.service

Once both services are running, you’ll need to start your Quai Network node. For information on how to start up your node, refer to the Run a Node guide.

Access Grafana

To access Grafana, open your web browser and navigate to http://localhost:3000. You will be prompted to log in. The default username and password are both admin.

If you are monitoring a local machine, you may keep the default password and username or change them. If you are monitoring an external node, i.e. you have forwarded your ports, it is highly recommended to change the default password and username.

Add Prometheus to Grafana

Once you have logged into Grafana, we need to add Prometheus as a data source. To do this, follow these steps:

1

Open Connections Menu

Click on Connections in the left-hand menu.
2

Add New Connection

In the connections menu, Click on Add new connection.
3

Select Prometheus

Select Prometheus from the list of data sources. You may need to search for it.

After adding Prometheus as a data source, we can create a dashboard to monitor our node. To do this, follow these steps:

1

Open Dashboards

Click on Dashboards in the left-hand menu.
2

Create New Dashboard

Click the New button.
3

Import Configuration

Click the Import button.
4

Paste Configuration

Paste the configuration file located in metrics_config/grafana_metrics.json into the text box. You can find the configuration file here

Monitor Your Node

After setting the data source and importing the configuration file, you should see a dashboard similar to the one below that displays the health and performance of your node. Your node is now being monitored in real time.