Skip to content

Grafana

Grafana is a powerful open-source visualization and monitoring platform that integrates seamlessly with Prometheus and other metrics backends. This chapter covers setting up Grafana dashboards for comprehensive blockchain node monitoring.


Terminal window
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y grafana
# Or use Docker
docker run -d \
--name grafana \
-p 3000:3000 \
-v grafana-data:/var/lib/grafana \
grafana/grafana
# Start and enable
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
┌─────────────────────────────────────────────────────────────────────────────┐
│ GRAFANA INITIAL SETUP │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. Access Grafana at http://localhost:3000 │
│ 2. Default credentials: admin / admin │
│ 3. Change password on first login │
│ 4. Add Prometheus data source │
│ 5. Import or create dashboards │
│ │
│ Configuration Files: │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ /etc/grafana/grafana.ini - Main configuration │ │
│ │ /etc/grafana/provisioning/ - Data sources & dashboards │ │
│ │ /var/lib/grafana/dashboards/ - Custom dashboards │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Terminal window
# Or configure via API
curl -X POST http://admin:admin@localhost:3000/api/datasources \
-H "Content-Type: application/json" \
-d '{
"name": "Prometheus",
"type": "prometheus",
"url": "http://localhost:9090",
"access": "proxy",
"isDefault": true
}'

┌─────────────────────────────────────────────────────────────────┐
│ KEY METRICS FOR BLOCKCHAIN NODES │
├─────────────────────────────────────────────────────────────────┤
│ │
│ BLOCKCHAIN METRICS: │
│ ━━━━━━━━━━━━━━━━━━━━ │
│ │
│ Metric Description │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ eth_block_number Current block height │
│ eth_head_block_number Latest synced block │
│ eth_syncing Sync status (true/false) │
│ blockchain_head_header Head header block │
│ │
│ NETWORK METRICS: │
│ ━━━━━━━━━━━━━━━━━ │
│ │
│ Metric Description │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ p2p_peers Number of connected peers │
│ p2p_dial_errors_total Failed dial attempts │
│ eth_gossip_sub_messages_total P2P message throughput │
│ │
│ TRANSACTION POOL: │
│ ━━━━━━━━━━━━━━━━ │
│ │
│ Metric Description │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ txpool_pending Pending transactions │
│ txpool_queued Queued transactions │
│ txpool_valid Valid transactions │
│ │
│ NODE PERFORMANCE: │
│ ━━━━━━━━━━━━━━━━━━ │
│ │
│ Metric Description │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ process_cpu_seconds_total CPU usage │
│ process_resident_memory_bytes Memory usage │
│ go_memstats_heap_alloc_bytes Heap allocation │
│ │
└─────────────────────────────────────────────────────────────────┘

DashboardIDSourceDescription
Ethereum Metrics14611CommunityComprehensive Ethereum node metrics
Node Exporter Full1860CommunitySystem-level metrics
Blockchain Dashboard13516CommunityGeneral blockchain monitoring
Ethereum 2.013713CommunityValidator metrics
Generic Prometheus10000Built-inCustom metrics
┌─────────────────────────────────────────────────────────────────┐
│ IMPORTING DASHBOARDS │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Method 1: Via Grafana UI │
│ ━━━━━━━━━━━━━━━━━━━━━━━━ │
│ 1. Navigate to Dashboards → Import │
│ 2. Enter dashboard ID (e.g., 14611) │
│ 3. Select Prometheus data source │
│ 4. Click Import │
│ │
│ Method 2: Via JSON file │
│ ━━━━━━━━━━━━━━━━━━━━━━━ │
│ 1. Download dashboard JSON │
│ 2. Dashboards → Import → Upload JSON │
│ 3. Select data source and import │
│ │
│ Method 3: Via Provisioning │
│ ━━━━━━━━━━━━━━━━━━━━━━ │
│ Create /etc/grafana/provisioning/dashboards/dashboards.yml: │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ apiVersion: 1 │ │
│ │ │ │
│ │ providers: │ │
│ │ - name: 'Dashboards' │ │
│ │ orgId: 1 │ │
│ │ folder: '' │ │
│ │ type: file │ │
│ │ options: │ │
│ │ path: /var/lib/grafana/dashboards │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘

Panel TypeUse Case
GraphTime series data (block times, peer count)
StatCurrent values (block number, sync status)
GaugePercentage values (CPU, memory usage)
TableTabular data (peer list, transaction details)
HeatmapHistorical patterns
# Block Production Rate (blocks per minute)
rate(eth_block_number[1m])
# Current Block Height
eth_block_number
# Peer Count
p2p_peers
# Memory Usage (bytes to GB)
process_resident_memory_bytes / 1024 / 1024 / 1024
# CPU Usage %
rate(process_cpu_seconds_total[5m]) * 100
# Transaction Pool Size
txpool_pending + txpool_queued
# Sync Progress %
(eth_block_number / eth_head_block_number) * 100
# Average Block Time
rate(eth_block_header_slot_seconds_sum[1h]) / rate(eth_block_header_slot_seconds_count[1h])
{
"dashboard": {
"title": "Ethereum Node Dashboard",
"panels": [
{
"title": "Block Height",
"type": "stat",
"targets": [
{
"expr": "eth_block_number",
"legendFormat": "Current Block"
}
]
},
{
"title": "Peer Count",
"type": "graph",
"targets": [
{
"expr": "p2p_peers",
"legendFormat": "Peers"
}
]
},
{
"title": "Memory Usage",
"type": "gauge",
"targets": [
{
"expr": "process_resident_memory_bytes / 1024 / 1024 / 1024",
"legendFormat": "GB"
}
],
"field": {
"max": 16,
"min": 0
}
}
]
}
}

┌─────────────────────────────────────────────────────────────────┐
│ GRAFANA ALERTING SETUP │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1. Enable alerting in grafana.ini: │
│ [unified_alerts] │
│ enabled = true │
│ │
│ 2. Configure notification channel: │
│ - Email │
│ - Slack │
│ - PagerDuty │
│ - Webhook │
│ │
│ 3. Create alert rules on panels: │
│ - Set conditions │
│ - Configure notifications │
│ - Add annotations │
│ │
└─────────────────────────────────────────────────────────────────┘
# alerting_rules.yml (can be imported to Grafana)
groups:
- name: ethereum_node
interval: 30s
rules:
- alert: NodeDown
expr: up{job="ethereum"} == 0
for: 2m
labels:
severity: critical
annotations:
summary: "Ethereum node is down"
- alert: HighPeerCount
expr: p2p_peers < 10
for: 5m
labels:
severity: warning
annotations:
summary: "Low peer count: {{ $value }}"
- alert: HighMemory
expr: process_resident_memory_bytes > 16000000000
for: 5m
labels:
severity: warning
annotations:
summary: "High memory usage"
- alert: SyncStalled
expr: eth_syncing == 1
for: 10m
labels:
severity: critical
annotations:
summary: "Node sync is stalled"

QuestionAnswer
What is Grafana?Open-source visualization and monitoring platform
What data source does Grafana commonly use with blockchain nodes?Prometheus
What are key Ethereum node metrics to monitor?Block height, peer count, memory, CPU, sync status
How do you set up alerts in Grafana?Create alert rules on panels, configure notification channels
What dashboard ID for Ethereum metrics?14611

  • Grafana provides powerful visualization for node monitoring
  • Use community dashboards for quick setup
  • Create custom dashboards for specific needs
  • Set up alerting for proactive monitoring
  • Integrate with Prometheus for metrics collection

In Chapter 40: Health Checks & Uptime, we’ll explore health monitoring.


Last Updated: 2026-02-20