Back to Blog

Homelab Monitoring: Complete Prometheus and Grafana Stack

Monitor your entire homelab with Prometheus and Grafana. Set up metrics collection, dashboards, and alerts for your self-hosted Docker infrastructure.

Posted by

Prometheus and Grafana monitoring

Why Monitor Your Homelab?

Without monitoring, you're flying blind. Know when disks are filling up, when services go down, or when your server is overloaded - before it becomes a problem.

Complete Monitoring Stack

version: "3.8"
services:
  prometheus:
    image: prom/prometheus:latest
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus
    ports:
      - "9090:9090"
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.retention.time=30d'

  grafana:
    image: grafana/grafana:latest
    volumes:
      - grafana_data:/var/lib/grafana
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin

  node-exporter:
    image: prom/node-exporter:latest
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'

  cadvisor:
    image: gcr.io/cadvisor/cadvisor:latest
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:ro
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro

volumes:
  prometheus_data:
  grafana_data:

Prometheus Configuration

# prometheus.yml
global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'node'
    static_configs:
      - targets: ['node-exporter:9100']

  - job_name: 'docker'
    static_configs:
      - targets: ['cadvisor:8080']

Essential Dashboards

  • Node Exporter Full (ID: 1860)
  • Docker Container Monitoring (ID: 893)
  • Traefik Dashboard (ID: 4475)

Import these from grafana.com/grafana/dashboards

Continue Reading