<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>check_snmp.c</TITLE>
</HEAD>
<BODY>
<BR>
<P><FONT SIZE=2>hi all,</FONT>
</P>
<P><FONT SIZE=2>i had a closer look at check_snmp.c and found something i don't like ;-))</FONT>
</P>
<P><FONT SIZE=2>> if (found == 0)</FONT>
<BR><FONT SIZE=2>> die (STATE_UNKNOWN,</FONT>
<BR><FONT SIZE=2>> _("%s problem - No data recieved from host\nCMD: %s\n"),</FONT>
<BR><FONT SIZE=2>> label,</FONT>
<BR><FONT SIZE=2>> command_line);</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>> /* WARNING if output found on stderr */</FONT>
<BR><FONT SIZE=2>> if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))</FONT>
<BR><FONT SIZE=2>> result = max_state (result, STATE_WARNING);</FONT>
<BR><FONT SIZE=2>></FONT>
</P>
<P><FONT SIZE=2>as you can see, if there is no data read from remote snmpd (in my case</FONT>
<BR><FONT SIZE=2>snmpd died), snmpget writes some messages to stderr, but check_snmp will</FONT>
<BR><FONT SIZE=2>silently ignore these messages....</FONT>
</P>
<P><FONT SIZE=2>maybe a first (quick and dirty ;-) aproach would be:</FONT>
</P>
<P><FONT SIZE=2>> /* WARNING if output found on stderr */</FONT>
<BR><FONT SIZE=2>> if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))</FONT>
<BR><FONT SIZE=2>> result = max_state (result, STATE_WARNING);</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>> /* close stderr */</FONT>
<BR><FONT SIZE=2>> (void) fclose (child_stderr);</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>> /* close the pipe */</FONT>
<BR><FONT SIZE=2>> if (spclose (child_process))</FONT>
<BR><FONT SIZE=2>> result = max_state (result, STATE_WARNING);</FONT>
<BR><FONT SIZE=2>></FONT>
<BR><FONT SIZE=2>> if (found == 0)</FONT>
<BR><FONT SIZE=2>> die (STATE_UNKNOWN,</FONT>
<BR><FONT SIZE=2>> _("%s problem - No data recieved from host, CMD: %s, Result: %s\n"),</FONT>
<BR><FONT SIZE=2>> label, command_line, input_buffer);</FONT>
<BR><FONT SIZE=2>></FONT>
</P>
<BR>
<P><FONT SIZE=2>cheers,</FONT>
<BR><FONT SIZE=2>Chris</FONT>
</P>
<BR>
<BR>
<P><FONT SIZE=2>___________________________________________________________</FONT>
</P>
<P> <FONT SIZE=2>Christian Masopust </FONT>
</P>
<P> <FONT SIZE=2>SIEMENS AG PSE SMC CI E CM </FONT>
<BR> <FONT SIZE=2>Tel: +43 (0) 5 1707 26866</FONT>
<BR> <FONT SIZE=2>E-mail: christian.masopust@siemens.com</FONT>
<BR> <FONT SIZE=2>Addr: Austria, 1210 Vienna, Siemensstraße 90-92, B. 34, Rm. 3057</FONT>
<BR> <FONT SIZE=2>___________________________________________________________</FONT>
</P>
<BR>
</BODY>
</HTML>