[Nagiosplug-devel] check_snmp.c

Masopust Christian christian.masopust at siemens.com
Fri Oct 3 04:10:23 CEST 2003


hi all,

i had a closer look at check_snmp.c and found something i don't like ;-))

>	if (found == 0)
>		die (STATE_UNKNOWN,
>		     _("%s problem - No data recieved from host\nCMD:
%s\n"),
>		     label,
>		     command_line);
>
>	/* WARNING if output found on stderr */
>	if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
>		result = max_state (result, STATE_WARNING);
>

as you can see, if there is no data read from remote snmpd (in my case
snmpd died), snmpget writes some messages to stderr, but check_snmp will
silently ignore these messages....

maybe a first (quick and dirty ;-) aproach would be:

>        /* 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);
>
>        /* close the pipe */
>        if (spclose (child_process))
>                result = max_state (result, STATE_WARNING);
>
>        if (found == 0)
>                die (STATE_UNKNOWN,
>                         _("%s problem - No data recieved from host, CMD:
%s, Result: %s\n"),
>                         label, command_line, input_buffer);
>


cheers,
Chris



___________________________________________________________

		Christian Masopust


		SIEMENS AG  PSE SMC CI E CM  
		Tel:   +43 (0) 5 1707 26866
		E-mail: christian.masopust at siemens.com
		Addr: Austria, 1210 Vienna, Siemensstraße 90-92, B. 34, Rm.
3057
		___________________________________________________________


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20031003/7656a69d/attachment.html>


More information about the Devel mailing list