Monitoring my homelab with Prometheus and Grafana
Getting back to tinkering has done me good this year. First project: actually knowing what my machines are doing, instead of finding out that a disk is full when something breaks.
The stack
- node_exporter on every machine, exposing CPU, memory, disk and network metrics;
- Prometheus scraping them every 30 seconds;
- Grafana for the dashboards, because I like graphs.
The Prometheus configuration is pleasantly short:
global:
scrape_interval: 30s
scrape_configs:
- job_name: node
static_configs:
- targets:
- 192.168.1.10:9100 # blog
- 192.168.1.11:9100 # backups
- 192.168.1.20:9100 # NAS
Alerts
A dashboard you never look at is useless, so Alertmanager sends me an email when a disk goes over 85% or a machine stops answering. The first alert fired after two days: the backup Pi at my parents' place had been unplugged to make room for a Christmas tree. In September.