Code

check_snmp don't warn anymore if something is printed on stderr
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Tue, 29 May 2007 05:22:32 +0000 (05:22 +0000)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Tue, 29 May 2007 05:22:32 +0000 (05:22 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1721 f882894a-f735-0410-b71e-b25c423dba1c

NEWS
plugins/check_snmp.c

diff --git a/NEWS b/NEWS
index 6ccb5a2d060099a75a1f3efbefcce35f250ec46b..daa2ebd02944d8c954c96bc0b6ce30fe5593ce96 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ This file documents the major additions and syntax changes between releases.
        check_load can optionally divide by number of cpus
        Fix check_time returning wrong OK when time is before the epoch on some arch
        Make check_http output more consistent
        check_load can optionally divide by number of cpus
        Fix check_time returning wrong OK when time is before the epoch on some arch
        Make check_http output more consistent
+       check_snmp don't warn anymore if something is printed on stderr
 
 1.4.8 11th April 2007
        Respects --without-world-permissions for setuid plugins
 
 1.4.8 11th April 2007
        Respects --without-world-permissions for setuid plugins
index f8bba99ec790367f8c708e9d7e42f16e990821b4..fd3028cf03aaf939a7c13b90f557e18030a0e8b1 100644 (file)
@@ -204,10 +204,12 @@ main (int argc, char **argv)
                exit (STATE_UNKNOWN);
        }
 
                exit (STATE_UNKNOWN);
        }
 
+#if 0          /* Removed May 29, 2007 */
        child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
        if (child_stderr == NULL) {
                printf (_("Could not open stderr for %s\n"), command_line);
        }
        child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
        if (child_stderr == NULL) {
                printf (_("Could not open stderr for %s\n"), command_line);
        }
+#endif
 
        while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
                asprintf (&output, "%s%s", output, input_buffer);
 
        while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
                asprintf (&output, "%s%s", output, input_buffer);
@@ -369,16 +371,21 @@ main (int argc, char **argv)
                        label,
                        command_line);
 
                        label,
                        command_line);
 
+#if 0          /* Removed May 29, 2007 */
        /* WARNING if output found on stderr */
        if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
                result = max_state (result, STATE_WARNING);
 
        /* close stderr */
        (void) fclose (child_stderr);
        /* WARNING if output found on stderr */
        if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
                result = max_state (result, STATE_WARNING);
 
        /* close stderr */
        (void) fclose (child_stderr);
+#endif
 
        /* close the pipe */
 
        /* close the pipe */
-       if (spclose (child_process))
-               result = max_state (result, STATE_WARNING);
+       if (spclose (child_process)) {
+               if (result == STATE_OK)
+                       result = STATE_UNKNOWN;
+               asprintf (&outbuff, "%s (%s)", outbuff, _("snmpget returned an error status"));
+       }
 
 /*     if (nunits == 1 || i == 1) */
 /*             printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */
 
 /*     if (nunits == 1 || i == 1) */
 /*             printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */