I have been digging though commands.c to see what I can
find out. One thing that stands out is that Nagios 2.x calls
process_external_command() which has a void return, and Nagios 3.x
calls process_external_command1() which returns an int. It seems the
3.x implementation is, in fact, checking for errors in the command its
attempting to process and will return -2 if it encounters any problems.
This would be quite helpful in determining the status of a submitted
command, but unfortunately the return value of both
check_external_command1() and check_external_command2() is never
considered by the calling function. Because of this, commands that are
malformed or have other issues are silently ignored and
check_for_external_commands() will always return OK. It seems like some
effort was put into better error handling in the external command
algorithm, but the changes don't seem to actually have any effect. I'm
curious as to why this is, as it affects the code I am adding to track
the progress of an external command from submission to completion.
<br><br>Thanks,<br><span class="sg"><br>-Scott</span><br><br><div><span class="gmail_quote">On 1/23/08, <b class="gmail_sendername">Marc Powell</b> <<a href="mailto:marc@ena.com">marc@ena.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>> -----Original Message-----<br>> From: <a href="mailto:nagios-users-bounces@lists.sourceforge.net">nagios-users-bounces@lists.sourceforge.net</a> [mailto:<a href="mailto:nagios-users-">nagios-users-</a><br>
> <a href="mailto:bounces@lists.sourceforge.net">bounces@lists.sourceforge.net</a>] On Behalf Of Scott Sanders<br>> Sent: Wednesday, January 23, 2008 8:39 AM<br>> To: <a href="mailto:nagios-users@lists.sourceforge.net">
nagios-users@lists.sourceforge.net</a><br>> Subject: Re: [Nagios-users] Determining the success or failure of<br>> externalcommands<br>><br><br><br>> nagios.cmd pipe. In order for the external command functionality to
<br>work<br>> the way I intend, I need to obtain a response from nagios so my server<br>can<br>> respond back to the client with the results of processing the external<br>> command. I am really hoping there is an easy way to do this, as
<br>replacing<br>> the nagios.cmd file with something besides a FIFO pipe requires<br>> modification to the nagios source and is something I was trying to<br>avoid.<br><br>Nagios was never designed to provide status back to a script submitting
<br>a command to the external command pipe because it is not a real-time<br>operation and the commands should always succeed (why wouldn't they?).<br>The command may not be read for quite some time after it's submitted,
<br>depending on what nagios is doing at the time.<br><br>As for logging, Nagios assumes that all external commands succeed and<br>logs nothing unless the command is malformed. There is additional<br>logging that is available by running nagios in DEBUG3 but that still
<br>doesn't indicate success or failure. commands.c handles external<br>commands. I'd suggest you start there and add in what additional logging<br>you feel you need.<br><br>--<br>Marc<br><br><br>-------------------------------------------------------------------------
<br>This SF.net email is sponsored by: Microsoft<br>Defy all challenges. Microsoft(R) Visual Studio 2008.<br><a href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">
https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>::: Messages without supporting info will risk being sent to /dev/null
<br></blockquote></div><br>