Page 1 of 1

Curious problem with check_snmp plugin

Posted: Thu Jun 28, 2012 9:19 pm
by tlum
I have a curious problem with the check_snmp plugin.

When monitoring CPU load it returns the load with 0.00 precision:

Code: Select all

# ./check_snmp -H myhost  -o UCD-SNMP-MIB::laLoad.1,UCD-SNMP-MIB:laLoad.2,UCD-SNMP-MIB::laLoad.3 -C public
SNMP OK - 3.40 5.57 5.00 | UCD-SNMP-MIB::laLoad.1=3.40 UCD-SNMP-MIB::laLoad.2=5.57 UCD-SNMP-MIB::laLoad.3=5.00
However, as soon as you add warnings and critical the decimal precision changes to 0:

Code: Select all

# ./check_snmp -H myhost  -o UCD-SNMP-MIB::laLoad.1,UCD-SNMP-MIB:laLoad.2,UCD-SNMP-MIB::laLoad.3 -C public -w65,65,65 -c90,90,90
SNMP OK - 0 3 4 | UCD-SNMP-MIB::laLoad.1=0 UCD-SNMP-MIB::laLoad.2=3 UCD-SNMP-MIB::laLoad.3=4
is there a way to preserve the precision?

Re: Curious problem with check_snmp plugin

Posted: Fri Jun 29, 2012 9:48 am
by agriffin
What happens if you add decimal places to your thresholds like this?

Code: Select all

# ./check_snmp -H myhost -o UCD-SNMP-MIB::laLoad.1,UCD-SNMP-MIB:laLoad.2,UCD-SNMP-MIB::laLoad.3 -C public -w65.00,65.00,65.00 -c90.00,90.00,90.00

Re: Curious problem with check_snmp plugin

Posted: Fri Jun 29, 2012 9:56 am
by tlum
Should have mentioned I tried that already. It throws an "Invalid warning threshold " message and then quits. It seems like warning and critical thresholds need to be integers and if you specify them the results get converted.

Re: Curious problem with check_snmp plugin

Posted: Mon Jul 02, 2012 10:24 am
by agriffin
I looked up the OIDs you're using, and they appear to be returning STRING values, not numbers. So you will probably have to write a wrapper script around check_snmp to interpret the values and exit with the proper status for nagios. The check_snmp plugin alone is not going to cut it for this.

Re: Curious problem with check_snmp plugin

Posted: Mon Jul 02, 2012 11:13 am
by tlum
I considered a problem with the strings so I had also tried:

Code: Select all

check_snmp -H vm4srvp01  -o UCD-SNMP-MIB::laLoadFloat.1,UCD-SNMP-MIB:laLoadFloat.2,UCD-SNMP-MIB::laLoadFloat.3 -C public
SNMP OK - Opaque: Float: 10.680000 Opaque: Float: 7.920000 Opaque: Float: 11.970000 | UCD-SNMP-MIB::laLoadFloat.1=Opaque: Float: 10.680000 UCD-SNMP-MIB::laLoadFloat.2=Opaque: Float: 7.920000 UCD-SNMP-MIB::laLoadFloat.3=Opaque: Float: 11.970000
even with numbers it still converts them to an integer and the warn and critical values will not take anything but an integer. So, it looks like the plugin is limited to integers and I'll have to do some thing external if I want to preserve the resolution.