Add monitoring.md: full stack docs, 21/21 targets, GPU textfile collector, pve_exporter

This commit is contained in:
post 2026-06-22 20:55:31 +00:00
parent cbd5763ec8
commit 0392ef330e

View file

@ -0,0 +1,108 @@
# Home AI Cluster — Monitoring Stack
Status: ✅ Phase 1+2 Complete (2026-06-22)
## Stack
| Component | Port | Role |
|-----------|------|------|
| Prometheus | :9090 | Metrics collection, 30d retention |
| Grafana | :3001 | Visualization (admin/cityweek) |
| Alertmanager | :9093 | Alerts → Telegram |
| Loki | :3100 | Log aggregation |
| Promtail | — | Log shipper → Loki |
| cAdvisor | :8082 | Docker container metrics |
| Blackbox | :9115 | HTTP/TCP probes |
Deploy path: `/opt/monitoring/` on 192.168.170.30
Code: `monitoring/` in post/network repo
## Targets — 21/21 UP
### node_exporter (:9100)
| Host | IP | Notes |
|------|----|-------|
| docker-host | 192.168.170.30 | Docker container |
| qore | 192.168.170.70 | Docker container + GPU textfile |
| proxmox | 192.168.170.40 | systemd binary |
| CT100 forgejo | 192.168.170.41 | systemd binary |
| CT102 mcp-hub | 192.168.170.43 | systemd binary |
| CT200 vpn-gw | 192.168.170.254 | systemd binary |
| TrueNAS | 192.168.170.22 | Binary at /mnt/datapool/prometheus/ |
**TrueNAS note:** OS filesystem is immutable (TrueNAS SCALE 26.0.0-BETA.1).
Binary must live on ZFS pool: `/mnt/datapool/prometheus/node_exporter`
### GPU Metrics (qore)
nvidia_gpu_exporter crashes with newer drivers due to field names with spaces.
**Fix:** textfile collector approach:
- Script: `/usr/local/bin/nvidia_metrics.sh` (Python3, parses nvidia-smi CSV)
- Output: `/var/lib/node_exporter/gpu.prom`
- Cron: every minute
- node_exporter started with `--collector.textfile.directory=/var/lib/node_exporter`
Metrics: `nvidia_gpu_temperature_celsius`, `nvidia_gpu_utilization_percent`,
`nvidia_gpu_memory_total/used/free_mib`, `nvidia_gpu_power_draw_watts`, `nvidia_gpu_fan_speed_percent`
### Proxmox Exporter (:9221)
`prometheus-pve-exporter` v3.9 installed on Proxmox host.
Config: `/etc/prometheus/pve.yml` (root@pam / cityweek)
Service: `/etc/systemd/system/pve-exporter.service`
**v3 syntax:** `--config.file=` not positional arg
### Blackbox HTTP Probes
- http://192.168.170.30:5678 — n8n
- http://192.168.170.30:5000 — Frigate
- http://192.168.170.30:2101 — Lightning web
- http://192.168.170.70:8189 — qore-admin
- http://192.168.170.70:8188 — ComfyUI
- http://192.168.170.41:3000 — Forgejo
- https://192.168.170.30:9443 — Portainer
- http://192.168.170.50:8080 — Nextcloud AIO
### Blackbox TCP Probes
- 192.168.170.30:1883 — MQTT
- 192.168.170.30:9735 — LND P2P
- 192.168.170.22:22 — TrueNAS SSH
## cAdvisor Issues
**Problem:** inotify limit exhausted with 84 containers
**Fix:** `sysctl -w fs.inotify.max_user_instances=8192` + `max_user_watches=1048576`
**Persisted:** `/etc/sysctl.conf`
**Port conflict:** was :8080 (taken), changed to :8082
**Flags:** `--disable_metrics=disk,diskIO,tcp,udp,percpu,sched,process` (performance)
## Alert Rules
| Alert | Condition |
|-------|-----------|
| NodeDown | instance unreachable 2m |
| DiskSpaceWarning | >85% |
| DiskSpaceCritical | >95% |
| HighCPU | >90% for 5m |
| HighMemory | >90% for 5m |
| ContainerHighRestart | >3 restarts in 5m |
| GPUHighTemp | >85°C for 5m |
| GPUVRAMCritical | >90% for 5m |
| ServiceDown | blackbox probe failed 3m |
| ServiceSlowResponse | probe duration >5s |
Alerts route to Telegram via Alertmanager native `telegram_configs`.
Bot token and chat_id stored on server in alertmanager.yml (not in git).
## Phase 3 TODO (Dashboards)
- [ ] Node Exporter Full (Grafana ID: 1860)
- [ ] GPU dashboard (custom, nvidia_gpu_* metrics)
- [ ] Proxmox VE dashboard (Grafana ID: 10347)
- [ ] Docker containers dashboard (Grafana ID: 193)
- [ ] Loki log explorer panel
- [ ] Keenetic SNMP exporter
- [ ] ZFS pool health (TrueNAS API or zfs_exporter)