summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-05-29 05:22:32 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-05-29 05:22:32 +0000
commit063d2541ef07e07a49ad7728c2c6b0154af7123f (patch)
treea48ab93b4759002070b241fb8a36020f952caf74
parent757e1676f1cea81fdb2852febb6f312ea6a67bd3 (diff)
downloadmonitoring-plugins-063d2541ef07e07a49ad7728c2c6b0154af7123f.tar.gz
check_snmp don't warn anymore if something is printed on stderr
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1721 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS1
-rw-r--r--plugins/check_snmp.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6ccb5a2d..daa2ebd0 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ This file documents the major additions and syntax changes between releases.
8 check_load can optionally divide by number of cpus 8 check_load can optionally divide by number of cpus
9 Fix check_time returning wrong OK when time is before the epoch on some arch 9 Fix check_time returning wrong OK when time is before the epoch on some arch
10 Make check_http output more consistent 10 Make check_http output more consistent
11 check_snmp don't warn anymore if something is printed on stderr
11 12
121.4.8 11th April 2007 131.4.8 11th April 2007
13 Respects --without-world-permissions for setuid plugins 14 Respects --without-world-permissions for setuid plugins
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index f8bba99e..fd3028cf 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -204,10 +204,12 @@ main (int argc, char **argv)
204 exit (STATE_UNKNOWN); 204 exit (STATE_UNKNOWN);
205 } 205 }
206 206
207#if 0 /* Removed May 29, 2007 */
207 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 208 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
208 if (child_stderr == NULL) { 209 if (child_stderr == NULL) {
209 printf (_("Could not open stderr for %s\n"), command_line); 210 printf (_("Could not open stderr for %s\n"), command_line);
210 } 211 }
212#endif
211 213
212 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) 214 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
213 asprintf (&output, "%s%s", output, input_buffer); 215 asprintf (&output, "%s%s", output, input_buffer);
@@ -369,16 +371,21 @@ main (int argc, char **argv)
369 label, 371 label,
370 command_line); 372 command_line);
371 373
374#if 0 /* Removed May 29, 2007 */
372 /* WARNING if output found on stderr */ 375 /* WARNING if output found on stderr */
373 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) 376 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
374 result = max_state (result, STATE_WARNING); 377 result = max_state (result, STATE_WARNING);
375 378
376 /* close stderr */ 379 /* close stderr */
377 (void) fclose (child_stderr); 380 (void) fclose (child_stderr);
381#endif
378 382
379 /* close the pipe */ 383 /* close the pipe */
380 if (spclose (child_process)) 384 if (spclose (child_process)) {
381 result = max_state (result, STATE_WARNING); 385 if (result == STATE_OK)
386 result = STATE_UNKNOWN;
387 asprintf (&outbuff, "%s (%s)", outbuff, _("snmpget returned an error status"));
388 }
382 389
383/* if (nunits == 1 || i == 1) */ 390/* if (nunits == 1 || i == 1) */
384/* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ 391/* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */