How to Set Up Grafana and Prometheus
Stand up a metrics stack with Prometheus, node_exporter and Grafana to visualize your home server's health.
What you'll build
A monitoring stack that scrapes system metrics and displays them in beautiful dashboards: Prometheus collects data, node_exporter exposes host metrics, and Grafana visualizes everything.
Prerequisites
- Docker and Docker Compose installed.
- A few minutes to import a community dashboard.
Docker Compose file
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prom_data:/prometheus
ports:
- "9090:9090"
restart: unless-stopped
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
pid: host
volumes:
- /:/host:ro,rslave
command:
- '--path.rootfs=/host'
restart: unless-stopped
grafana:
image: grafana/grafana-oss:latest
container_name: grafana
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
restart: unless-stopped
volumes:
prom_data:
grafana_data:Prometheus configuration
Create prometheus.yml next to your Compose file:
global:
scrape_interval: 15s
scrape_configs:
- job_name: node
static_configs:
- targets: ["node-exporter:9100"]Then start everything:
docker compose up -dWire up Grafana
- Open
http://your-server-ip:3000and log in (defaultadmin/admin, then change it). - Add a data source → Prometheus → URL
http://prometheus:9090. - Import dashboard ID 1860 (Node Exporter Full) from the Grafana dashboard library.
- Select your Prometheus data source and load it.
You now have CPU, memory, disk, network and temperature graphs updating live.
Add container metrics (optional)
Add cAdvisor to the stack and a scrape job for it to see per-container CPU and memory. Import a cAdvisor dashboard to visualize which containers use the most resources.
Secure it
Keep Grafana behind a reverse proxy with HTTPS and a strong admin password. Prometheus and node_exporter should stay on your internal network only — never expose them to the internet.
Articles connexes
Home Server Monitoring: A Complete Guide
Monitor your homelab with Uptime Kuma, Prometheus and Grafana — track uptime, temperatures, disk health and get alerts before things break.
Installer Uptime Kuma
Surveillez vos services homelab et recevez des alertes en cas de panne.
Installer Home Assistant
Exécutez Home Assistant Container sur votre serveur pour une domotique locale.