2

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

edit: if I use -w=range it parses properly but still converts the value to positive.

root@ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::CurrentNoiseFloor.0 -w=~:-85 -c=~:-80 -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 CRITICAL - *97* | DEVICE-MIB::CurrentNoiseFloor.0=97  

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?

Oesor
  • 300
  • 1
  • 2
  • 16

2 Answers2

3

-w=-85: -c=-80: is the syntax I needed, but check_snmp still converts the output to positive when an error is triggered. Bug report filed.

Oesor
  • 300
  • 1
  • 2
  • 16
2

I used this -w~:0.5 -c 0.5. Using ~:0.5 allows negative values. I got this from website: https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT

ljf0021
  • 21
  • 1
  • You should include an explanation of how that works. And make use of the formatting options to make the answer more readable. – kasperd Nov 18 '15 at 21:25