Metrics and Monitoring
Metrics allow you to gather run time statistics on your aggregator or attester node.
Overview
Prometheus is a robust, open-source tool designed for event monitoring and alerting. It collects and stores metrics as time series data, enabling querying and visualization of system performance. Metrics for Aggregator or Attester nodes can be gathered from:
Standard Prometheus metrics: Node uptime, performance statistics, and more.
libp2p metrics: For peer-to-peer networking data.
gossipsub metrics: For the topic-based publish/subscribe communication protocol.
Enabling metrics may impact performance and is therefore optional.
Enabling Metrics
To activate metrics, use the --metrics
flag with the node commands (aggregator
or attester
).
libp2p Metrics Scraping
Since libp2p metrics do not emit events, data must be actively scraped. To facilitate this, a dedicated server will be launched to expose metrics.
By default, this server listens on port 6060.
You can specify an alternative port using the
--metrics.port <port>
option.
Example Usage
Enable metrics on an aggregator node using the default port (6060):
Enable metrics on an attester node with a custom port:
Example for Prometheus and Grafana Integration
Overview
To monitor your AVS nodes, you need to set up Prometheus for collecting metrics, configure your Attester or Aggregator node to capture system-level metrics (as explained earlier), and use Grafana to visualize the data. By using Docker Compose, you can streamline the process by defining and managing these services in a single configuration file.
For a comprehensive example, refer to the Simple Price Oracle Example repository, which contains a working configuration for Prometheus, Grafana, and the node setup.
Docker Compose Configuration
Prometheus
Prometheus acts as the core of the monitoring system, collecting metrics from the node. The setup uses the prom/prometheus:latest
image and binds a custom configuration file, prometheus.yaml
, to the container.
Grafana
Grafana provides a user-friendly interface to visualize and analyze the data collected by Prometheus. This setup uses the grafana/grafana:latest
image and configures persistent data storage using a Docker volume.
Volume Details:
./grafana/provisioning:/etc/grafana/provisioning
This volume is used for provisioning Grafana with predefined configurations, such as data sources and dashboard templates. You can place YAML files in this directory to automate the setup of data sources or other settings upon container startup.
Example YAML file for a data source:
./grafana/dashboards:/var/lib/grafana/dashboards
This volume stores dashboard JSON files, which define the visual layouts and metrics to display in Grafana. By placing preconfigured dashboards here, you ensure they are automatically available after the container starts.
grafana-storage:/var/lib/grafana
This Docker volume ensures persistent storage for Grafana's internal database, including user-created dashboards, settings, and other data. If the Grafana container is recreated, this volume retains all saved configurations.
Starting the Setup
Follow these steps to start the monitoring setup:
Prepare the Configuration:
Ensure the
prometheus.yaml
file is in the same directory as the Docker Compose file.Customize the Grafana provisioning and dashboards directories as needed.
Start the Services:
Run the following command to start Prometheus and Grafana in detached mode:
Access the Services:
Prometheus will be available at: http://localhost:9090
Grafana will be available at: http://localhost:3000
Log in to Grafana using the default credentials (
admin/admin
, unless changed in the configuration).
Visualize Metrics:
Once the setup is complete, use Grafana to create or import dashboards to visualize the metrics collected by Prometheus.
Screenshots of the Othentic-CLI dashboard in Grafana
Last updated