[Pkg-nagios-devel] Bug#460405: nagios-plugins-standard: check_snmp does not allow " chars in cmdline

Joerg Delker jd at onix.de
Sat Jan 12 13:24:05 UTC 2008

Package: nagios-plugins-standard
Version: 1.4.10-1
Severity: important

snmpd can be queried for customized "extend"s.
A configured extend like
    extend avail_mem /usr/local/bin/check_avail_mem.pl
can be queried as
    snmpget -c public -v1 ds9 'nsExtendOutput1Line."avail_mem"'
    NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."avail_mem" = STRING: 749764

If you try to query this with check_snmp like
    check_snmp -H $HOSTADDRESS$ -C public -o 'nsExtendOutput1Line."syslog-idletime"'
this results into
    Could not open pipe: /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c public ds9:161 nsExtendOutput1Line."syslog-idletime"

Unfortuantely, check_snmp contains code in popen.c that does not allow any " chars in
the command line and bails out with above error.

I fixed this by commenting out the follwing block:

--- popen.c.old 2008-01-12 14:16:39.000000000 +0100
+++ popen.c     2008-01-12 14:16:54.000000000 +0100
@@ -133,8 +133,10 @@
        strcpy (cmd, cmdstring);

        /* This is not a shell, so we don't handle "???" */
        if (strstr (cmdstring, "\""))
                return NULL;

        /* allow single quotes, but only if non-whitesapce doesn't occur on both sides */
        if (strstr (cmdstring, " ' ") || strstr (cmdstring, "'''"))

-- System Information:
Debian Release: lenny/sid
Architecture: i386 (i686)

Kernel: Linux 2.6.18-5-k7 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages nagios-plugins-standard depends on:
ii  dnsutils                1:9.4.2-1        Clients provided with BIND
ii  fping                   2.4b2-to-ipv6-14 sends ICMP ECHO_REQUEST packets to
ii  host                    20000331-9       utility for querying DNS servers
ii  libc6                   2.7-5            GNU C Library: Shared libraries
ii  libldap2                2.1.30.dfsg-13.5 OpenLDAP libraries
ii  libmysqlclient15off     5.0.45-5         MySQL database client library
ii  libnet-snmp-perl        5.2.0-1          Script SNMP connections
ii  libpq4                  8.1.10-1         PostgreSQL C client library
ii  libradius1              0.3.2-11         /bin/login replacement with RADIUS
ii  nagios-plugins-basic    1.4.10-1         Plugins for the nagios network mon
ii  qstat                   2.11-1           Command-line tool for querying qua
ii  radiusclient1           0.3.2-11         /bin/login replacement which uses 
ii  smbclient               3.0.28-1         a LanManager-like simple client fo
ii  snmp                    5.4.1~dfsg-5     SNMP (Simple Network Management Pr
ii  ucf                     3.004            Update Configuration File: preserv

nagios-plugins-standard recommends no packages.

-- no debconf information

More information about the Pkg-nagios-devel mailing list