Prometheus and Grafana Monitoring Setup on Ubuntu (Step-by-Step) - Part2
Connecting Prometheus to Grafana & Monitoring Worker Nodes
In this blog, we will learn how to connect Prometheus with Grafana, create dashboards, monitor multiple worker nodes using Node Exporter, generate load for testing, and share Grafana dashboards.
🔹 Architecture Overview
-
Prometheus → Collects and stores metrics (Time Series Database)
-
Node Exporter → Exposes system metrics (CPU, memory, disk, network)
-
Grafana → Visualizes metrics using dashboards
-
Stress Tool → Generates load for testing
-
Loki & Promtail → Log aggregation
-
ElasticSearch & Kibana → Log & metric analysis
🔹 Step 1: Connect Prometheus to Grafana
-
Login to Grafana Dashboard
-
Navigate to:
-
Select Prometheus
-
Enter the Prometheus URL:
-
Click Save & Test
✔️ If the connection is successful, Grafana will confirm that Prometheus is reachable.
🔹 Step 2: Create a Grafana Dashboard
-
On the Grafana top menu, click ➕ (Create)
-
Select Import
-
Enter Dashboard ID:
-
Click Load
-
Choose Prometheus as the data source
-
Click Import
🎉 You will now see a full system monitoring dashboard with CPU, memory, disk, and network metrics.
🔹 Step 3: Generate Load for Testing Metrics
To simulate CPU load on the server:
Install stress tool
Generate CPU load
This helps verify whether Prometheus and Grafana are properly collecting and displaying metrics.
🔹 Step 4: Connect Worker Nodes to Monitoring Server
1️⃣ Create Worker Nodes
Create 2 worker nodes (EC2 / VM instances).
2️⃣ Update /etc/hosts on Monitoring Server
Add the worker node details:
3️⃣ Install Node Exporter on Worker Nodes
📌 Node Exporter is mandatory to collect metrics from worker nodes.
Run the Node Exporter installation script on each worker node.
Once running, verify:
🔹 Step 5: Add Worker Nodes to Prometheus
Edit Prometheus configuration:
Add worker node targets under scrape_configs:
Restart Prometheus Service
⚠️ Important: After modifying any service configuration, restart the service.
🔹 Step 6: Share Grafana Dashboard
-
Open the dashboard
-
Click Share
-
Select Snapshot
-
Click Create Snapshot
-
Share the generated URL
📌 Note: Replace localhost with public IP before sharing.
Example Snapshot URL:
🔹 Useful Grafana Dashboard IDs
| Dashboard ID | Description |
|---|---|
| 1860 | Node Exporter Full |
| 10180 | Kubernetes / Node Metrics |
| 14731 | Linux System Monitoring |
| 11074 | Resource Monitoring |
| 8919 | Host Metrics |
🔹 Monitoring & Logging Tools Summary
| Tool | Purpose |
|---|---|
| Prometheus | Metrics collection |
| Node Exporter | System metrics |
| Grafana | Dashboards & visualization |
| Loki + Promtail | Logs |
| ElasticSearch | Logs & metrics |
| Kibana | Dashboards |
🔹 Conclusion
With Prometheus and Grafana, you can easily monitor multiple servers from a single monitoring node. By adding Node Exporter on worker nodes and updating Prometheus targets, real-time metrics become available instantly. Grafana dashboards help visualize performance, troubleshoot issues, and share insights with teams.
Comments
Post a Comment