#Lab: Prometheus & Grafana Setup
Set up monitoring with Prometheus and Grafana.
#🎯 Objectives
- Deploy Prometheus
- Add exporters
- Create Grafana dashboard
#Task 1: Docker Compose Stack
yaml
1version: '3.8'
2services:
3 prometheus:
4 image: prom/prometheus:latest
5 ports:
6 - "9090:9090"
7 volumes:
8 - ./prometheus.yml:/etc/prometheus/prometheus.yml
9
10 grafana:
11 image: grafana/grafana:latest
12 ports:
13 - "3000:3000"
14
15 node-exporter:
16 image: prom/node-exporter:latest
17 ports:
18 - "9100:9100"#Task 2: Prometheus Config
yaml
1# prometheus.yml
2global:
3 scrape_interval: 15s
4
5scrape_configs:
6 - job_name: 'prometheus'
7 static_configs:
8 - targets: ['localhost:9090']
9
10 - job_name: 'node'
11 static_configs:
12 - targets: ['node-exporter:9100']#Task 3: Start and Configure
bash
1docker compose up -d
2
3# Access:
4# Prometheus: http://localhost:9090
5# Grafana: http://localhost:3000 (admin/admin)#✅ Success Criteria
- Prometheus collecting metrics
- Node exporter visible
- Grafana dashboard showing data