Metrics

fairyring & fairyringclient provide support for metrics to allow users to monitor the health, performance and status of fairyring & fairyringclient.

fairyring setup

fairyring uses Prometheus to publish metrics, It can be enabled through the config.toml file.

#######################################################
###       Instrumentation Configuration Options     ###
#######################################################
[instrumentation]

# When true, Prometheus metrics are served under /metrics on
# PrometheusListenAddr.
# Check out the documentation for the list of available metrics.
prometheus = true

# Address to listen for Prometheus collector(s) connections
prometheus_listen_addr = ":26660"

# Maximum number of simultaneous connections.
# If you want to accept a larger number than the default, make sure
# you increase your OS limits.
# 0 - unlimited.
max_open_connections = 3

# Instrumentation namespace
namespace = "fairyring"

After enabling metrics in config.toml, If you restart your node, you can check if the metrics are working by:

fairyringclient setup

fairyringclient enables metrics on port :2222 by default, you can check your metrics port by:

Example Output:

You can update the metrics port by the following command:

Prometheus installation and Setup

After enabling metrics on fairyring node / fairyringclient, you will need a program to scrape its data, we suggest using Prometheus in this example.

Install Prometheus by following the Official Installation guide in the same machine as your node. Create a Prometheus config file, we will create one at $HOME/.fairyring/config/prometheus.yml in this example. The config file should look something like this:

Start Prometheus server:

Prometheus runs its server on port 9090 by default, we suggest to run Prometheus in a different port, 2112 in this case, to avoid conflict with the fairyring node gRPC port (9090 by default`).

Visualization

After installing Prometheus and enabling fairyring metrics, you will need something to visualize the data. We suggest using Grafana for building a dashboard to visualize the data.

You can use their cloud service of run it yourself. You can follow their Official Installation Guide for a tutorial on installing Grafana. After installing Grafana, you can start it by:

The command above will start a server on localhost:3000.

After you started a Grafana server, you can now create your own dashboard or import the one we already created for fairyring & fairyringclient.

Last updated