Grafana
Chapter 39: Grafana Dashboards
Section titled “Chapter 39: Grafana Dashboards”Overview
Section titled “Overview”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.
39.1 Grafana Setup
Section titled “39.1 Grafana Setup”Installation
Section titled “Installation”# Ubuntu/Debiansudo apt-get updatesudo apt-get install -y grafana
# Or use Dockerdocker run -d \ --name grafana \ -p 3000:3000 \ -v grafana-data:/var/lib/grafana \ grafana/grafana
# Start and enablesudo systemctl start grafana-serversudo systemctl enable grafana-serverInitial Configuration
Section titled “Initial Configuration”┌─────────────────────────────────────────────────────────────────────────────┐│ 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 │ ││ └─────────────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────────────────┘Adding Prometheus Data Source
Section titled “Adding Prometheus Data Source”# Or configure via APIcurl -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 }'39.2 Essential Ethereum Node Metrics
Section titled “39.2 Essential Ethereum Node Metrics”Key Metrics to Monitor
Section titled “Key Metrics to Monitor”┌─────────────────────────────────────────────────────────────────┐│ 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 ││ │└─────────────────────────────────────────────────────────────────┘39.3 Recommended Dashboards
Section titled “39.3 Recommended Dashboards”Popular Grafana Dashboard IDs
Section titled “Popular Grafana Dashboard IDs”| Dashboard | ID | Source | Description |
|---|---|---|---|
| Ethereum Metrics | 14611 | Community | Comprehensive Ethereum node metrics |
| Node Exporter Full | 1860 | Community | System-level metrics |
| Blockchain Dashboard | 13516 | Community | General blockchain monitoring |
| Ethereum 2.0 | 13713 | Community | Validator metrics |
| Generic Prometheus | 10000 | Built-in | Custom metrics |
Importing Dashboards
Section titled “Importing Dashboards”┌─────────────────────────────────────────────────────────────────┐│ 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 │ ││ └─────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘39.4 Creating Custom Dashboards
Section titled “39.4 Creating Custom Dashboards”Panel Types
Section titled “Panel Types”| Panel Type | Use Case |
|---|---|
| Graph | Time series data (block times, peer count) |
| Stat | Current values (block number, sync status) |
| Gauge | Percentage values (CPU, memory usage) |
| Table | Tabular data (peer list, transaction details) |
| Heatmap | Historical patterns |
Sample Prometheus Queries
Section titled “Sample Prometheus Queries”# Block Production Rate (blocks per minute)rate(eth_block_number[1m])
# Current Block Heighteth_block_number
# Peer Countp2p_peers
# Memory Usage (bytes to GB)process_resident_memory_bytes / 1024 / 1024 / 1024
# CPU Usage %rate(process_cpu_seconds_total[5m]) * 100
# Transaction Pool Sizetxpool_pending + txpool_queued
# Sync Progress %(eth_block_number / eth_head_block_number) * 100
# Average Block Timerate(eth_block_header_slot_seconds_sum[1h]) / rate(eth_block_header_slot_seconds_count[1h])Dashboard JSON Example
Section titled “Dashboard JSON Example”{ "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 } } ] }}39.5 Alerting Configuration
Section titled “39.5 Alerting Configuration”Setting Up Alerts
Section titled “Setting Up Alerts”┌─────────────────────────────────────────────────────────────────┐│ 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 ││ │└─────────────────────────────────────────────────────────────────┘Sample Alert Rules
Section titled “Sample Alert Rules”# 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"39.6 Interview Questions
Section titled “39.6 Interview Questions”| Question | Answer |
|---|---|
| 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 |
Summary
Section titled “Summary”- 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
Next Chapter
Section titled “Next Chapter”In Chapter 40: Health Checks & Uptime, we’ll explore health monitoring.
Last Updated: 2026-02-20