One Prometheus for unRaid, a Synology NAS, and a VPS: What I Got Wrong
说明与用途
将三台机器(unRaid、Synology NAS、VPS)统一到单一的 Prometheus/Grafana 监控面板。修复了文件系统重复、虚拟机缺失 CPU 频率、cAdvisor 指标错误和主机名错误等问题。结果:准确的指标和及时的告警。
问题
Three separate machines (unRaid, Synology NAS, VPS) were monitored independently, leading to inaccurate metrics, misleading alerts, and hidden resource issues.
结果
Accurate single-screen monitoring of 3 hosts with 7 scrape targets, 16 alert rules, and clear metrics: 47 CPU cores, 158 GHz current, 142 GB RAM, 64 TB storage, 155 running containers.
工作流
- Deploy node_exporter and cAdvisor on each host
- Configure node_exporter to expose host metrics on :9100
- Configure cAdvisor to expose container metrics on :8080, :8081, :8082
- Add filter to cAdvisor metrics: node_memory_working_set_bytes{job=~"cadvisor.*", name!=""}
- Create Prometheus query to sum node_filesystem_size_bytes with mountpoint and fstype filters
- Add textfile collector script on VPS to expose CPU MHz as node_cpu_mhz_current_hz
- Configure node_exporter to use hostname from compose file
- Build Grafana dashboards for host and container metrics
- Create alert rules for storage, CPU, memory, and container counts
- Test and iterate until dashboards and alerts reflect true state
证据
node_exporter sees the host: CPU, memory, network, disks, filesystems, temperatures. It is cgroup-blind: it cannot tell you which container is eating your RAM.
The fix is one filter, but you have to know to write it: # container metrics: anything with a name, and only that container_memory_working_set_bytes{job=~"cadvisor.*", name!=""}
A naive sum(node_filesystem_size_bytes) therefore reported capacity for disks I don't have.
The VPS reported nothing at all — it's a KVM guest, and a guest has no /sys/devices/system/cpu/cpu0/cpufreq.
The host dropdown in the dashboard offered 9f9afcccc962 as a machine. That's a container ID: node_exporter's uname collector reports the process's UTS namespace...
- 记录日期: 2026-10-18T05:56:14.034Z