📊 Monitoring a Node with Grafana & Prometheus
Monitor blockchain nodes with real-time charts and alerts.
🔹 What You'll Monitor
Metric | Importance | Prometheus Query |
---|---|---|
CPU Usage | Avoid overload | node_cpu_seconds_total{mode!="idle"} |
RAM Usage | Detect memory pressure | node_memory_MemAvailable_bytes |
Disk Space | Prevent sync/storage failure | node_filesystem_avail_bytes |
Network I/O | Check if syncing and broadcasting | node_network_receive_bytes_total |
🔹 Step 1: Install Prometheus
sudo apt update
sudo apt install prometheus
🔹 Step 2: Configure Prometheus
sudo nano /etc/prometheus/prometheus.yml
Edit:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
🔹 Step 3: Install Node Exporter
sudo apt install prometheus-node-exporter
📍 Metrics available at:
http://<your-vps-ip>:9100/metrics
🔹 Step 4: Install Grafana
sudo apt install -y software-properties-common
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
sudo apt update && sudo apt install grafana -y
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
Access Grafana at:
http://<your-vps-ip>:3000
Login: admin / admin
🔹 Step 5: Connect Grafana to Prometheus
- Go to Configuration > Data Sources
- Add Prometheus
- Set URL:
http://localhost:9090
- Click Save & Test
🔹 Step 6: Import Node Dashboard
- Go to Create > Import
- Use ID
1860
for Node Exporter Full - Select your Prometheus data source
- Click Import
🎉 Now you're monitoring everything in Grafana!