Curious problem with check_snmp plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Curious problem with check_snmp plugin

Post 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?
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Curious problem with check_snmp plugin

Post 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
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Re: Curious problem with check_snmp plugin

Post 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.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Curious problem with check_snmp plugin

Post 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.
tlum
Posts: 16
Joined: Thu Jun 28, 2012 9:07 pm

Re: Curious problem with check_snmp plugin

Post 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.
Locked