These rules use standard IF-MIB and SNMPv2-MIB metrics. Metric names depend on your snmp.yml module configuration.
Thresholds for bandwidth and error rates are rough defaults - adjust to your environment.
job=~".*snmp.*" matches the official prometheus-snmp-exporter Helm chart. Adjust it if you deploy otherwise.
critical
9.13.1.SNMP target down
SNMP device {{ $labels.instance }} is unreachable.
- alert: SnmpTargetDown
expr: 'up{job=~".*snmp.*"} == 0'
for: 5m
labels:
severity: critical
annotations:
summary: SNMP target down (instance {{ $labels.instance }})
description: "SNMP device {{ $labels.instance }} is unreachable.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
9.13.2.SNMP target flapping
SNMP target on {{ $labels.instance }} changed state {{ $value | printf "%.0f" }} times in the last 10 minutes.
# Catches a crash-looping service, which the down rule misses because each successful scrape resets its for: timer.
# 4 changes means at least 2 down/up cycles in 10m; one outage followed by a recovery counts only 2.
- alert: SnmpTargetFlapping
expr: 'changes(up{job=~".*snmp.*"}[10m]) >= 4'
for: 0m
labels:
severity: critical
annotations:
summary: SNMP target flapping (instance {{ $labels.instance }})
description: "SNMP target on {{ $labels.instance }} changed state {{ $value | printf \"%.0f\" }} times in the last 10 minutes.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
9.13.3.SNMP interface down
Interface {{ $labels.ifDescr }} on {{ $labels.instance }} is operationally down while administratively up.
- alert: SnmpInterfaceDown
expr: '(ifOperStatus{job=~".*snmp.*"} == 2) and on(instance, job, ifIndex) (ifAdminStatus{job=~".*snmp.*"} == 1)'
for: 2m
labels:
severity: critical
annotations:
summary: SNMP interface down (instance {{ $labels.instance }})
description: "Interface {{ $labels.ifDescr }} on {{ $labels.instance }} is operationally down while administratively up.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
9.13.4.SNMP interface high bandwidth usage inbound
Interface {{ $labels.ifDescr }} on {{ $labels.instance }} inbound utilization is above 80%.
# Threshold is a rough default. ifSpeed is a Gauge32 that maxes out at ~4.29 Gbps. For 10G+ interfaces, use ifHighSpeed (in Mbps) instead.
- alert: SnmpInterfaceHighBandwidthUsageInbound
expr: 'rate(ifHCInOctets{job=~".*snmp.*"}[5m]) * 8 / ifSpeed > 0.80 and ifSpeed > 0'
for: 15m
labels:
severity: warning
annotations:
summary: SNMP interface high bandwidth usage inbound (instance {{ $labels.instance }})
description: "Interface {{ $labels.ifDescr }} on {{ $labels.instance }} inbound utilization is above 80%.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
9.13.5.SNMP interface high bandwidth usage outbound
Interface {{ $labels.ifDescr }} on {{ $labels.instance }} outbound utilization is above 80%.
# Threshold is a rough default. ifSpeed is a Gauge32 that maxes out at ~4.29 Gbps. For 10G+ interfaces, use ifHighSpeed (in Mbps) instead.
- alert: SnmpInterfaceHighBandwidthUsageOutbound
expr: 'rate(ifHCOutOctets{job=~".*snmp.*"}[5m]) * 8 / ifSpeed > 0.80 and ifSpeed > 0'
for: 15m
labels:
severity: warning
annotations:
summary: SNMP interface high bandwidth usage outbound (instance {{ $labels.instance }})
description: "Interface {{ $labels.ifDescr }} on {{ $labels.instance }} outbound utilization is above 80%.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
9.13.6.SNMP interface high inbound error rate
Interface {{ $labels.ifDescr }} on {{ $labels.instance }} has an inbound error rate above 5%.
# Threshold is a rough default. Adjust based on your network environment.
- alert: SnmpInterfaceHighInboundErrorRate
expr: 'rate(ifInErrors{job=~".*snmp.*"}[5m]) / (rate(ifHCInUcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCInBroadcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCInMulticastPkts{job=~".*snmp.*"}[5m])) > 0.05 and (rate(ifHCInUcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCInBroadcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCInMulticastPkts{job=~".*snmp.*"}[5m])) > 0'
for: 5m
labels:
severity: warning
annotations:
summary: SNMP interface high inbound error rate (instance {{ $labels.instance }})
description: "Interface {{ $labels.ifDescr }} on {{ $labels.instance }} has an inbound error rate above 5%.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
9.13.7.SNMP interface high outbound error rate
Interface {{ $labels.ifDescr }} on {{ $labels.instance }} has an outbound error rate above 5%.
# Threshold is a rough default. Adjust based on your network environment.
- alert: SnmpInterfaceHighOutboundErrorRate
expr: 'rate(ifOutErrors{job=~".*snmp.*"}[5m]) / (rate(ifHCOutUcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCOutBroadcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCOutMulticastPkts{job=~".*snmp.*"}[5m])) > 0.05 and (rate(ifHCOutUcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCOutBroadcastPkts{job=~".*snmp.*"}[5m]) + rate(ifHCOutMulticastPkts{job=~".*snmp.*"}[5m])) > 0'
for: 5m
labels:
severity: warning
annotations:
summary: SNMP interface high outbound error rate (instance {{ $labels.instance }})
description: "Interface {{ $labels.ifDescr }} on {{ $labels.instance }} has an outbound error rate above 5%.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"info
9.13.8.SNMP device restarted
SNMP device {{ $labels.instance }} has restarted (uptime < 5 minutes).
# sysUpTime is in centiseconds (hundredths of a second).
- alert: SnmpDeviceRestarted
expr: 'sysUpTime / 100 < 300'
for: 0m
labels:
severity: info
annotations:
summary: SNMP device restarted (instance {{ $labels.instance }})
description: "SNMP device {{ $labels.instance }} has restarted (uptime < 5 minutes).\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"