#360 check_snmp: fix for multiple non numeric OIDs

open
nobody
Bugfix (123)
5
2014-01-24
2011-08-04
Martin Rohrbach
No

Patch against Plugin Version (-V output): v1.4.15 (nagios-plugins 1.4.15)
Plugin Name: check_snmp
Example Plugin Commandline: -u a,b,c,d,e (see below)
Tested on operating system: SLES 11 SP 1 (Linux 2.6.32.29-0.3-default #1 SMP 2011-02-25 13:36:59 +0100 x86_64 x86_64 x86_64 GNU/Linux)
Tested on architecture: x86_64
Tested with compiler: gcc

When multiple OIDs are specified and the first one is numeric while another one is not, an error is encountered because is_numeric is not reset in the loop. The fix does just that.

bash# ./check_snmp -V
check_snmp v1.4.15 (nagios-plugins 1.4.15)
bash# uname -a
Linux kobarid 2.6.32.29-0.3-default #1 SMP 2011-02-25 13:36:59 +0100 x86_64 x86_64 x86_64 GNU/Linux

bash# ./check_snmp -H mary.unix.db.de -C nasfiler -o .1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.25.0 -w @1:2, -c @4:6,
No valid data returned
bash# ./check_snmp_numeric_fix -H mary.unix.db.de -C nasfiler -o .1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.25.0 -w @1:2, -c @4:6,
SNMP OK - 3 "The system's global status is normal. " | iso.3.6.1.4.1.789.1.2.2.4.0=3

Discussion

  • Andy Brist
    Andy Brist
    2014-01-24

    https://github.com/monitoring-plugins/monitoring-plugins/issues/1013

    I have been unable to reproduce this issue. We do not have a netapp device in house, but I have been attempting to reproduce the behavior with other OIDs.

    .1.3.6.1.4.1.789.1.2.2.4.0 --> returns an integer
    .1.3.6.1.4.1.789.1.2.2.25.0 --> returns a DisplayString

    I have attempted to use OIDs with similar returns (same type, nearly same output) and have yet to encounter this error. Do you still have this issue with the check_snmp plugin and you netapp device?