Monitoring a Synology NAS with snmp_exporter and Prometheus
Disk health, RAID state, temperatures and free space from a Synology NAS in Prometheus, using SNMPv3, the built-in synology module of snmp_exporter, and a set of alerts that catch failing disks early.
On this page
My NAS holds the backups for everything else in the homelab, so it is the one box I most need to know about before something fails. Synology's own notifications are fine, but I wanted the NAS in the same Prometheus and Alertmanager setup as the rest of the cluster, with the same routing, silences and dashboards.
The good news is that you do not need to install an agent on the NAS. DSM ships an SNMP daemon, and Prometheus' snmp_exporter already includes a synology module.
Overview
Prometheus ──scrape──▶ snmp_exporter (in Kubernetes) ──SNMPv3/UDP 161──▶ NAS
Prometheus does not talk SNMP itself. It scrapes snmp_exporter, passing the NAS as a target, and the exporter translates that into SNMP requests.
Step 1: Enable SNMPv3 in DSM
In DSM, go to Control Panel → Terminal & SNMP → SNMP:
- Enable the SNMP service.
- Turn off SNMPv1/v2c, because v2c sends a plaintext community string.
- Enable SNMPv3 with a dedicated user, for example
prometheus:- authentication protocol SHA with a long random password
- privacy protocol AES with a different long random password
- Apply.
Then check that the daemon really listens on the network interface and not just on loopback:
netstat -lnu | grep 161
# udp 0 0 0.0.0.0:161 0.0.0.0:*
When I first set this up, the daemon only listened on 127.0.0.1:161 because the setting had not been applied yet. Every scrape timed out, and the exporter logs gave no hint why.
Step 2: Open the firewall path
If the cluster and the NAS sit in different VLANs or subnets, your router has to allow UDP 161 from the cluster nodes to the NAS. Pod traffic usually leaves the cluster with the node's IP as its source (SNAT), so allow the node subnet rather than the pod CIDR.
Keep the rule narrow: one protocol, one port, one destination. Also check DSM's own firewall (Control Panel → Security → Firewall) if you have enabled it.
This was my second timeout. DSM was set up correctly, but the router dropped the traffic because only NFS was allowed from the cluster network to the NAS. The exporter's log shows the same request timeout (after 3 retries) in both cases, so check both places.
Step 3: Deploy snmp_exporter with credentials from a secret
I use the community Helm chart prometheus-snmp-exporter. The built-in synology module already knows the right OIDs, so the custom config only adds auth settings. The passwords come from a Kubernetes secret through environment variables, which keeps them out of the Helm values in Git:
config: |
auths:
nas_v3:
version: 3
security_level: authPriv
username: prometheus
auth_protocol: SHA
password: ${SNMP_AUTH_PASS}
priv_protocol: AES
priv_password: ${SNMP_PRIV_PASS}
extraArgs:
- --config.file=/etc/snmp_exporter/snmp.yml
- --config.expand-environment-variables
envFrom:
- secretRef:
name: nas-snmp
serviceMonitor:
enabled: true
selector: {}
params:
- name: nas
target: 192.0.2.10
module: [synology]
auth: [nas_v3]
interval: 60s
scrapeTimeout: 30s
Two details:
--config.expand-environment-variablesmakes the exporter replace${...}with environment values when it loads the config. Without it, the literal string${SNMP_AUTH_PASS}is sent as the password.- The default chart config already contains the standard modules. The second file adds only the
authsblock, so you do not need to generate the hugesnmp.ymlyourself.
The secret itself is stored encrypted, as a SealedSecret in my case, so the repo never contains the plaintext passwords.
Step 4: Check the metrics
You can test from inside the exporter pod before you wait for Prometheus:
wget -qO- 'http://127.0.0.1:9116/snmp?target=192.0.2.10&module=synology&auth=nas_v3' | grep -E '^(systemStatus|diskStatus|raidStatus)'
Useful metrics from the synology module:
| Metric | Meaning |
|---|---|
systemStatus, powerStatus | 1 = normal, 2 = failed |
systemFanStatus, cpuFanStatus | 1 = normal |
temperature | system temperature in °C |
diskStatus | 1 normal, 2 initialized, 3 not initialized, 4 system partition failed, 5 crashed |
diskHealthStatus | 1 normal, 2 warning, 3 critical, 4 failing |
diskBadSector, diskTemperature | per disk |
raidStatus | 1 normal, 2 repairing, 11 degraded, 12 crashed, … |
raidFreeSize, raidTotalSize | per volume, in bytes |
Step 5: Alerts that matter
These are the rules I use, as a PrometheusRule. Hard failures fire right away, and slow trends wait so they do not flap:
groups:
- name: nas
rules:
- alert: NasSnmpScrapeFailed
expr: absent_over_time(systemStatus[15m])
for: 5m
labels: {severity: warning}
annotations:
summary: "No SNMP data from the NAS for 15 minutes"
- alert: NasSystemFailed
expr: systemStatus != 1 or powerStatus != 1
labels: {severity: critical}
- alert: NasDiskFailed
expr: diskStatus >= 4 or diskHealthStatus >= 3
labels: {severity: critical}
- alert: NasDiskHealthWarning
expr: diskHealthStatus == 2
for: 30m
labels: {severity: warning}
- alert: NasDiskBadSectorsIncreasing
expr: delta(diskBadSector[1d]) > 0
labels: {severity: warning}
- alert: NasDiskTemperatureHigh
expr: diskTemperature > 55
for: 15m
labels: {severity: warning}
- alert: NasRaidDegraded
expr: raidStatus == 11 or raidStatus == 12
labels: {severity: critical}
- alert: NasRaidRepairing
expr: raidStatus == 2
for: 1h
labels: {severity: warning}
- alert: NasRaidSpaceLow
expr: raidFreeSize / raidTotalSize < 0.10
for: 1h
labels: {severity: warning}
The most valuable one is NasDiskBadSectorsIncreasing. A growing bad-sector count often shows up weeks before a disk is marked as failing, which leaves time to order a replacement calmly.
NasSnmpScrapeFailed is the safety net. If the NAS, the network path or the credentials break, you get one clear alert instead of silence. During setup it fires until everything works, which is a convenient end-to-end test.
Wrap-up
With an agent-free setup and a handful of rules, the NAS reports into the same monitoring as everything else. If your scrapes time out, check three things in this order:
- Does the daemon listen on the network interface, not only on loopback?
- Does every firewall in between allow UDP 161?
- Do the SNMPv3 user, protocols and passwords match exactly?