Default netsnmp group memAvailSwap / memTotalSwap threshold raises alerts for devices that have no swap space allocated
Description
Some NetSNMP devices have no swap space at all – for example, the lightweight OpenWrt distribution running on routers/wireless APs. In my case, I'm testing with OpenWrt 10.03.1 final (using snmpd-static - 5.4.2.1-5). This device has no swap and returns 0 for both "memAvailSwap" and "memTotalSwap". This causes alerts for the rule "expression="memAvailSwap / memTotalSwap * 100.0"", e.g. "A Threshold has been exceeded on node: ... The parameter memAvailSwap / memTotalSwap * 100.0 reached a value of 0 while the threshold is 10.0. This alert will be rearmed when memAvailSwap / memTotalSwap * 100.0 reaches 15.0."
The fix is to add a filter so the threshold only applies when a non-zero value is returned for memTotalSwap.
<group name="netsnmp" rrdRepository="/var/lib/opennms/rrd/snmp/"> ... <expression description="Trigger an alert when the amount of available swap space reaches 10% or less of the total amount of swap space for two consecutive measurement intervals (by default, 5 minutes each) (indicating a possible lack of enough free physical memory), including only systems that report having a swap device of size greater than 0 bytes" type="low" ds-type="node" value="10.0" rearm="15.0" trigger="2" ds-label="" filterOperator="or" expression="memAvailSwap / memTotalSwap * 100.0"> <resource-filter field="memTotalSwap">^[1-9]+[0-9]*$</resource-filter> </expression> ... </group>
Thanks, Tim Miller Dyck
Acceptance / Success Criteria
None
Lucidchart Diagrams
Activity
Alejandro Galue May 2, 2012 at 6:34 PM
Fixed on revision 3626841fe505d71ad1d8a249a30237654acfc75d for 1.10
Some NetSNMP devices have no swap space at all – for example, the lightweight OpenWrt distribution running on routers/wireless APs. In my case, I'm testing with OpenWrt 10.03.1 final (using snmpd-static - 5.4.2.1-5). This device has no swap and returns 0 for both "memAvailSwap" and "memTotalSwap". This causes alerts for the rule "expression="memAvailSwap / memTotalSwap * 100.0"", e.g. "A Threshold has been exceeded on node: ... The parameter memAvailSwap / memTotalSwap * 100.0 reached a value of 0 while the threshold is 10.0. This alert will be rearmed when memAvailSwap / memTotalSwap * 100.0 reaches 15.0."
The fix is to add a filter so the threshold only applies when a non-zero value is returned for memTotalSwap.
<group name="netsnmp" rrdRepository="/var/lib/opennms/rrd/snmp/">
...
<expression
description="Trigger an alert when the amount of available swap space reaches 10% or less of the total amount of swap space for two consecutive measurement intervals (by default, 5 minutes each) (indicating a possible lack of enough free physical memory), including only systems that report having a swap device of size greater than 0 bytes"
type="low" ds-type="node" value="10.0" rearm="15.0"
trigger="2" ds-label="" filterOperator="or" expression="memAvailSwap / memTotalSwap * 100.0">
<resource-filter field="memTotalSwap">^[1-9]+[0-9]*$</resource-filter>
</expression>
...
</group>
Thanks,
Tim Miller Dyck