Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#578 snmp_check -C parsing error

Release (specify)
closed-invalid
nobody
5
2012-11-12
2012-11-08
No

Hi there,
I'm having some issues with release v1.4.16 when using check_snmp with -C arg.

See above:
- In check_snmp (nagios-plugins 1.4.16) v1.4.16:
# ./check_snmp -C border -H 10.10.0.6 -o iso.3.6.1.2.1.2.2.1.9.3 -v
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] 10.10.0.6:161 iso.3.6.1.2.1.2.2.1.9.3
(Service Check Timed Out)

- In check_snmp (nagios-plugins 1.3.1) v1.24.2.2:
# ./check_snmp -C border -H 10.10.0.6 -o iso.3.6.1.2.1.2.2.1.9.3 -v
/usr/bin/snmpget -t 1 -r 9 -m ALL -v 1 -c border 10.10.0.6:161 iso.3.6.1.2.1.2.2.1.9.3
RFC1213-MIB::ifLastChange.3 = Timeticks: (362154105) 41 days, 21:59:01.05
SNMP OK - Timeticks: (362154105) 41 days, 21:59:01.05

It seems that the -C (--community too) argument was not treated.

OS/Arch: Linux nagios3teste 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686 GNU/Linux
Compiler: gcc version 4.4.5 (Debian 4.4.5-8)

Discussion

  • After read the source I saw the verbose message above only show some args.

    Full command above (through pid info):
    /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c 200.196.193.25:161 iso.3.6.1.2.1.2.2.1.9.3

     
  • J. Bern
    J. Bern
    2012-11-09

    I can *not* confirm that this is a general problem with this plugin version ...

    [root@nagios ~]# nagios-plugins-1.4.16/plugins/check_snmp -C public -H $TARGET -o sysUpTime.0 -v
    /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] $TARGET:161 sysUpTime.0
    DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1356951290) 157 days, 1:18:32.90
    SNMP OK - Timeticks: (1356951290) 157 days, 1:18:32.90 |

    [root@nagios ~]# nagios-plugins-1.4.16/plugins/check_snmp -C wrong -H $TARGET -o sysUpTime.0 -v
    /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] $TARGET:161 sysUpTime.0
    External command error: Timeout: No Response from $TARGET:161.

    The community being hidden in the command line (as "ps" sees it) is a safety mechanism of snmpget itself:

    [root@nagios ~]# nagios-plugins-1.4.16/plugins/check_snmp -C wrong -H $TARGET -o sysUpTime.0 -v &
    [...]
    [root@nagios ~]# ps auwwwwx | grep snmpget
    root 22907 0.0 0.1 4364 1856 pts/1 S 09:17 0:00 /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c $TARGET:161 sysUpTime.0

    Source retrieved 28-Jun, md5sum is:
    862f5e44fb5bc65ce7e5d86d654d4da0 nagios-plugins-1.4.16.tar.gz

    You might want to rerun the tests with numeric-only OIDs, to make sure that the timeout isn't due to the MIB file parsing.

     
  • # md5sum nagios-plugins-1.4.16.tar.gz
    862f5e44fb5bc65ce7e5d86d654d4da0 nagios-plugins-1.4.16.tar.gz

    # ./check_snmp -P 2c -C border -H 10.10.0.6 -o sysUpTime.0 -v
    /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c [authpriv] 10.10.0.6:161 sysUpTime.0
    command_line[0] /usr/bin/snmpget
    command_line[1] -t
    command_line[2] 1
    command_line[3] -r
    command_line[4] 5
    command_line[5] -m
    command_line[6] ALL
    command_line[7] -v
    command_line[8] 2c
    command_line[9] -c
    command_line[10] border
    command_line[11] 10.10.0.6:161
    command_line[12] sysUpTime.0

    After read the code (i'm not a dev), I changed a little bit to see more output, and I noticed that the community arg (command_line[10]) is filled of blank spaces with the same lenght of string.

     
  • Sorry guys, my bad. Solved when installed snmp-mibs-downloader.
    Thanks @j-bern for the help.

     
    • status: open --> closed-invalid