Aller au contenu
TutorielsAutomatisationIntermédiaire

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.

par HomeServersGuide Team1 min de lecture

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 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 -d

Wire up Grafana

  1. Open http://your-server-ip:3000 and log in (default admin / admin, then change it).
  2. Add a data source → Prometheus → URL http://prometheus:9090.
  3. Import dashboard ID 1860 (Node Exporter Full) from the Grafana dashboard library.
  4. 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

GuidesAutomatisationIntermédiaire

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.

2 min de lecture
TutorielsAutomatisationDébutant

Installer Uptime Kuma

Surveillez vos services homelab et recevez des alertes en cas de panne.

3 min de lecture
TutorielsAutomatisationIntermédiaire

Installer Home Assistant

Exécutez Home Assistant Container sur votre serveur pour une domotique locale.

3 min de lecture