Prometheus Setup
Overview
Prometheus scrapes and stores the metrics exposed by the OTEL collector, providing a time-series database for querying and analysis.
Prerequisites
- Completed OpenTelemetry Collector Setup
- OTEL collector running and exposing metrics on port 8889
Setup Steps
Step 1: Create Prometheus Configuration
Create a prometheus.yml
file:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'aztec-node'
static_configs:
- targets: ['otel-collector:8889']
labels:
instance: 'aztec-node-1'
Adjust the instance
label to identify your node uniquely if you're running multiple nodes.
Step 2: Add Prometheus to Docker Compose
Add Prometheus to your docker-compose.yml
:
services:
# ... existing services (otel-collector, etc.) ...
prometheus:
image: prom/prometheus:latest
container_name: aztec-prometheus
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
networks:
- aztec
restart: always
volumes:
prometheus-data:
Step 3: Start Prometheus
docker compose up -d
Step 4: Verify Prometheus
Access Prometheus UI at http://localhost:9090
and verify:
- Go to Status → Target Health to check that
aztec-node
target is up - Go to Graph and query a metric (e.g.,
aztec_archiver_block_height
)
Using Prometheus
Query Metrics
Use the Prometheus UI to explore and query metrics:
- Navigate to
http://localhost:9090/graph
- Enter a metric name in the query box (use autocomplete to discover available metrics)
- Click Execute to see the results
- Switch between Table and Graph views
Example Queries
# Current block height
aztec_archiver_block_height
# Block sync rate (blocks per second)
rate(aztec_archiver_block_height[5m])
# Memory usage
process_resident_memory_bytes
# CPU usage rate
rate(process_cpu_seconds_total[5m])
Next Steps
- Proceed to Grafana Setup to configure visualization and alerting
- Return to Monitoring Overview