How to Monitor a 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:
Click on "Connections", then
"Add new connection", and
select "Hosted Prometheus metrics".
Now select "Via Grafana Alloy", then
on step 2, select "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:
If you compile 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, by taking care of replacing the placeholders related to the prometheus
endpoint with the parameters obtained when creating a Grafana Cloud account before:
GCLOUD_HOSTED_METRICS_URL
GCLOUD_HOSTED_METRICS_ID
GCLOUD_RW_API_KEY
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.
Log-in to Grafana Cloud and create a new Dashboard.
Pick the Prometheus instance you created before as the data source.
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, into the dashboard.
Grafana comes with powerful data visualization tools. You can read about how to query and transform data here, while here you will find examples on how to build Prometheus queries.
This template will kick-start your dashboard.
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:
Now reload alloy
and check its status:
node_exporter
provides a lot of metrics. Poke at them through the Grafana Explorer or use one of the many prepared dashboard (e.g., this one) to see comprehensive information. Once you have a dashboard ready, you can also use it to configure a few alerts (e.g., on disk space, etc).
Last updated