How to Monitor Signer

We will use Grafana Cloud to observe and monitor both the Signer and its corresponding Stacks node.

Requirements

Grafana's application observability docs have a great quick-start. We will use:

  • Grafana Cloud to collect metrics and visualize them.

  • Grafana Alloy, on the Signer host, to push the metrics.

Creating a Grafana Cloud account

Before we begin, create a Grafana Cloud account (they offer a free tier that you can use).

Once done, access your dashboard and follow these steps:

1

Add a new connection

Click on "Connections", then "Add new connection".

2

Select Hosted Prometheus metrics

Select "Hosted Prometheus metrics".

3

Choose via Grafana Alloy

Select "Via Grafana Alloy", then on step 2 choose "Run Grafana Alloy" to generate an API token.

Note the token GCLOUD_RW_API_KEY and the parameters GCLOUD_HOSTED_METRICS_URL and GCLOUD_HOSTED_METRICS_ID; we will use them later.

Configuring the Signer and the Stacks node

Ensure both your Signer configuration and your node configuration include the following lines:

# signer-config.toml

# ...

# Adjust to 0.0.0.0:30001 if running in Docker.
metrics_endpoint = "127.0.0.1:30001"

The pre-compiled binaries already include the monitoring feature. However, if you are compiling the application binaries yourself, remember to enable the Cargo feature monitoring_prom while building them, for example:

Once both binaries are running with the updated configuration, you can peek at the metrics being exposed:

Also, you'll have a /info endpoint on the same port:

Install Alloy

Follow these instructions to install Grafana Alloy.

On Debian-based distributions:

Configure Alloy

Edit the file /etc/alloy/config.alloy as follows, replacing the placeholders related to the prometheus endpoint with the parameters obtained when creating a Grafana Cloud account:

  • GCLOUD_HOSTED_METRICS_URL

  • GCLOUD_HOSTED_METRICS_ID

  • GCLOUD_RW_API_KEY

Enable and start Alloy:

Metrics from your Signer and node will now start being pushed to Grafana Cloud.

Visualizing the metrics

You can now start building a dashboard to visualize the metrics.

  1. Log in to Grafana Cloud and create a new Dashboard.

  2. Pick the Prometheus instance you created before as the data source.

  3. Create a new panel and pick stacks_signer_current_reward_cycle from the metrics.

You should now be able to see Stacks' current reward cycle, as measured by the Signer, in the dashboard.

Grafana comes with powerful data visualization tools. You can read about how to query and transform data here, and find examples on how to build Prometheus queries.

This template will kick-start your dashboard.

A screenshot of the Grafana dashboard instantiated from the template

Bonus: monitoring the host

Since we are here, we can also monitor the host itself. Debian-based distributions make it very easy for us by using node_exporter.

This will expose metrics on port 9100 of localhost.

We can now configure alloy to push them to Grafana. Edit your /etc/alloy/config.alloy file and add the following scrape target to the prometheus.scrape "default" targets list:

Now reload alloy and check its status:

node_exporter provides a lot of metrics. Explore them through the Grafana Explorer or use one of the many prepared dashboards (e.g., this one) to see comprehensive information. Once you have a dashboard ready, you can also use it to configure alerts (e.g., on disk space, etc.).

Was this helpful?