Monitoring Stack with Node Exporter, Prometheus, and Grafana π Overview π This project sets up a monitoring stack using Node Exporter, Prometheus, and Grafana to collect and visualize system metrics from a Linux machine (or WSL) using Docker Compose.
Technologies Used: π οΈ Node Exporter: Collects system metrics. π Prometheus: Scrapes and stores metrics. π§βπ» Grafana: Visualizes metrics in dashboards. π Prerequisites βοΈ Docker and Docker Compose installed. If not, follow the Docker installation guide. π WSL 2 (Windows Subsystem for Linux) if running on Windows with Ubuntu. WSL Installation Guide. π₯οΈ Basic knowledge of Docker, Prometheus, and Grafana. π Setup Instructions π οΈ
Download and Extract Node Exporter:
wget https://github.com/prometheus/node_exporter/releases/download/v1.9.1/node_exporter-1.9.1.linux-amd64.tar.gz tar xvfz node_exporter-1.9.1.linux-amd64.tar.gz cd node_exporter-1.9.1.linux-amd64 IMG IMG IMG
Run Node Exporter:
./node_exporter Node Exporter will be running on http://localhost:9100. π IMG Verify Metrics:
Open http://localhost:9100/metrics in your browser. π Or use curl to verify: curl http://localhost:9100/metrics IMG Note the WSL IP (if needed): If Prometheus is outside WSL, get the WSL IP using:
hostname -I Replace localhost with this IP in prometheus.yml later.
Create docker-compose.yml: In your project directory, create the file docker-compose.yml with the following content:
version: β3β services: prometheus: image: prom/prometheus ports: - β9090:9090β volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana ports: - β3000:3000β Configure prometheus.yml: Create the file prometheus.yml with the following content:
global: scrape_interval: 15s scrape_configs:
docker-compose up -d IMG 4. Verify Prometheus:
Open http://localhost:9090 in your browser. π Check that Node Exporter is UP under Status β Targets. β
Access Grafana: Open http://localhost:3000 in your browser. π
Default login: admin / admin IMG Add Prometheus Data Source:
Go to Configuration β Data Sources β Add Prometheus.
Set the URL to http://prometheus:9090 (or use http://
Go to Create (+) β Import β Dashboard ID 1860 IMG (or download the Node Exporter Full Dashboard). Select Prometheus as the data source and click Import. View Metrics: The imported dashboard will display CPU, memory, disk, and network metrics. π IMG
Troubleshooting β οΈ Docker Integration with WSL: If running on Windows with WSL, make sure Docker Desktop is integrated with your WSL distro. Follow the Docker WSL2 guide for setup. π₯οΈ If you run Prometheus outside WSL, make sure to replace localhost with the WSL IP in the prometheus.yml file. π‘