check_snmp warning & critical thresholds with negative values
Posted
by Oesor
on Server Fault
See other posts from Server Fault
or by Oesor
Published on 2010-05-18T14:07:40Z
Indexed on
2010/05/18
14:11 UTC
Read the original article
Hit count: 365
I'm querying some signal level values measured in dBm, and the SNMP host on the remove device reports the values as negative values, ie, -90 dBm. However, check-snmp seems to be incapable of dealing with negative numbers as part of its threshold values. If I specify the values as part of a collection of OIDs, it accepts the syntax but converts the snmp value to positive, thus always generating a WARNING/CRITICAL result:
root@ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::AverageReceiveSNR.0,DEVICE-MIB::CurrentNoiseFloor.0 -w 10:,~:-85 -c 15:,~:-80 -vvvv
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] 192.168.1.100:161 DEVICE-MIB::AverageReceiveSNR.0 DEVICE-MIB::CurrentNoiseFloor.0
DEVICE-MIB::AverageReceiveSNR.0 = INTEGER: 25
DEVICE-MIB::CurrentNoiseFloor.0 = INTEGER: -97
Processing line 1
oidname: DEVICE-MIB::AverageReceiveSNR.0
response: = INTEGER: 25
Processing line 2
oidname: DEVICE-MIB::CurrentNoiseFloor.0
response: = INTEGER: -97
SNMP CRITICAL - 25 *97* | DEVICE-MIB::AverageReceiveSNR.0=25 DEVICE-MIB::CurrentNoiseFloor.0=97
If I run it with a single OID, it gives me an error that the format is incorrect:
root@ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::CurrentNoiseFloor.0 -w ~:-85 -c ~:-80 -vvvv
Range format incorrect
And if I run it with no thresholds defined, it works properly and returns the right value. This makes the graphs correct, however it'll never generate a notification when out of range:
root@ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::CurrentNoiseFloor.0 -vvvv
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] 192.168.1.100:161 DEVICE-MIB::CurrentNoiseFloor.0
DEVICE-MIB::CurrentNoiseFloor.0 = INTEGER: -97
Processing line 1
oidname: DEVICE-MIB::CurrentNoiseFloor.0
response: = INTEGER: -97
SNMP OK - -97 | DEVICE-MIB::CurrentNoiseFloor.0=-97
What am I doing wrong here? How would I, for example, generate a CRITICAL when the noise floor is -80 dBm or higher, a WARNING when it's -85 to -80 dBm, and an OK when -85 dBm or lower? Do I have to write my own SNMP plugins when dealing with negative values?
© Server Fault or respective owner