Grafana Setup
Overview
Grafana provides rich visualization and alerting capabilities for your metrics, allowing you to create custom dashboards and receive notifications when issues arise.
Prerequisites
- Completed Prometheus Setup
- Prometheus running and accessible at
http://prometheus:9090
Setup Steps
Step 1: Add Grafana to Docker Compose
Add Grafana to your docker-compose.yml
:
services:
# ... existing services (otel-collector, prometheus, etc.) ...
grafana:
image: grafana/grafana:latest
container_name: aztec-grafana
ports:
- 3000:3000
volumes:
- grafana-data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- aztec
restart: always
volumes:
# ... existing volumes ...
grafana-data:
networks:
aztec:
name: aztec
Admin Password Security
Change the default admin password (GF_SECURITY_ADMIN_PASSWORD
) to a secure value for production deployments.
Step 2: Start Grafana
docker compose up -d grafana
Step 3: Access Grafana
- Navigate to
http://localhost:3000
- Login with username
admin
and the password you set (default:admin
) - You'll be prompted to change the password on first login
Step 4: Add Prometheus Data Source
- In the left sidebar, click Connections → Data sources
- Click Add data source
- Search for and select Prometheus
- Configure:
- Name: Aztec Prometheus
- URL:
http://prometheus:9090
- Click Save & Test
You should see a green success message confirming Grafana can connect to Prometheus.
Creating Dashboards
Option 1: Create a Basic Dashboard
- In the left sidebar, click Dashboards
- Click New → New Dashboard
- Click Add visualization
- Select your Aztec Prometheus data source
- In the query editor, enter a metric (explore available metrics using the autocomplete)
- Customize the visualization type and settings
- Click Apply
- Click Save dashboard icon (top right)
- Give your dashboard a name and click Save
Option 2: Import a Pre-built Dashboard
If the Aztec community has created shared dashboards:
- Click + → Import
- Enter dashboard ID or upload JSON file
- Select Aztec Prometheus as the data source
- Click Import
Recommended Dashboard Panels
Example panels you can create (adjust metric names based on what's actually available):
- Block Height Over Time: Line graph tracking block sync progress
- Sync Rate: Line graph showing blocks per second (use
rate()
function) - Peer Count: Gauge showing P2P connections
- Memory Usage: Line graph of
process_resident_memory_bytes
- CPU Usage: Line graph of
rate(process_cpu_seconds_total[5m])
Setting Up Alerts
Configure alerts to notify you of issues:
Step 1: Create an Alert Rule
- In the left sidebar, click Alerting (bell icon)
- Click Alert rules → New alert rule
- Configure your alert:
- Query: Select your Prometheus data source and metric (e.g.,
aztec_node_block_height
) - Condition: Define the threshold (e.g.,
rate(aztec_node_block_height[5m]) < 0.001
to alert if no blocks in 5 minutes) - Evaluation interval: How often to check (e.g., 1m)
- Query: Select your Prometheus data source and metric (e.g.,
- Click Save
Step 2: Configure Contact Points
- Under Alerting, click Contact points
- Click Add contact point
- Choose your notification method:
- Email: Configure SMTP settings
- Slack: Add webhook URL
- PagerDuty: Add integration key
- Webhook: Custom HTTP endpoint
- Click Save
Step 3: Create Notification Policies
- Under Alerting, click Notification policies
- Click New notification policy
- Define routing rules to send alerts to specific contact points
- Click Save
Example Alert Rules
Node Sync Alert
Alert if the node stops syncing blocks:
- Query:
rate(aztec_archiver_block_height[5m])
- Condition:
< 0.001
- Description: Node has not synced any blocks in the last 5 minutes
High Memory Usage Alert
Alert if memory usage exceeds threshold:
- Query:
process_memory_usage
- Condition:
> 8000000000
(8GB) - Description: Node memory usage exceeds 8GB
Peer Connection Alert
Alert if peer count drops too low:
- Query:
discv5_connected_peer_count
- Condition:
< 3
- Description: Node has fewer than 3 peer connections
Next Steps
- Explore the Monitoring Overview for troubleshooting and metrics reference
- Join the Aztec Discord to share dashboards with the community
- Configure additional notification channels for your alerts