[Nagiosplug-checkins] nagiosplug/plugins check_snmp.c,1.71,1.72

Thomas Guyot dermoth at users.sourceforge.net
Tue May 29 07:22:34 CEST 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19004/plugins

Modified Files:
	check_snmp.c 
Log Message:
check_snmp don't warn anymore if something is printed on stderr


Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- check_snmp.c	29 May 2007 04:25:24 -0000	1.71
+++ check_snmp.c	29 May 2007 05:22:32 -0000	1.72
@@ -204,10 +204,12 @@
 		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);
 	}
+#endif
 
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
 		asprintf (&output, "%s%s", output, input_buffer);
@@ -369,16 +371,21 @@
 			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);
+#endif
 
 	/* 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); */





More information about the Commits mailing list