[Nagiosplug-devel] Patch for check_snmp.c

Mayhew, Andrew amayhew at verisign.com
Wed Jul 31 14:54:03 CEST 2002


Don't know if anyone else particularly cares, but for our environment we
like to get the full response from the SNMP get even if the status is OK.
So this patch changes the output behaviour slightly to make it slightly more
consistent in this regard.

Share and enjoy.
--Andrew Mayhew <amayhew at verisign.com>

*** check_snmp.c        Wed Feb 27 22:42:59 2002
--- check_snmp.c-new    Wed Jul 31 14:44:27 2002
***************
*** 220,226 ****
                        p2 = strpbrk (p2, "0123456789");
                        response_value[i] = strtoul (p2, NULL, 10);
                        iresult = check_num (i);
!                       show = ssprintf (show, "%d", response_value[i]);
                }
  
                else if (eval_method[i] & CRIT_STRING) {
--- 220,227 ----
                        p2 = strpbrk (p2, "0123456789");
                        response_value[i] = strtoul (p2, NULL, 10);
                        iresult = check_num (i);
!                       /* For consistency we want the full SNMP response
every time. */
!                       show = ssprintf (show, "%s", response);
                }
  
                else if (eval_method[i] & CRIT_STRING) {
***************
*** 291,297 ****
        /* WARNING if output found on stderr */
        if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
                result = max (result, STATE_WARNING);
- 
        /* close stderr */
        (void) fclose (child_stderr);
  
--- 292,297 ----




More information about the Devel mailing list