Tracking commands as they move through nagios

Scott Sanders lists at jssjr.com
Thu Jan 24 22:58:24 CET 2008


I am posting to devel because my initial thread on the users mailing list
now concerns developers more than it does the average user.

Some background first. I am developing an API into Nagios so that I can
safely expose Nagios internals to scripts and applications that don't reside
on the same system as the Nagios daemon. Using NFS to share the var
directory was never really an option in my environment, so I put together a
little API over http that uses the same Apache basic auth mechanism as the
CGI's to restrict access. A query is made by forming a URL and an XML object
is returned containing the query results. For example, a query like
https://nagios.domain.com/=/find/host/address/192.168.1.1 would return an
XML object identical to the one found in the objects.cache for the host with
that address, but in XML instead of a tab-delimited key/value pair inside a
curly brackets block. Now that this works, I am working on adding
functionality that will let me submit commands to the nagios.cmd pipe
through my API.

My problem is that if i simply submit a command to the API and it is placed
in the FIFO pipe, I have no meaningful information to pass back to the
client. This creates a problem, as the client may wish to sit in a loop
waiting for the command to be processed before continuing. (For example,
scheduling a service downtime before stopping a database to take a backup
snapshot.) I need to find some way to determine the success or failure of an
external command and then return that to the client within the http timeout
window. After looking at commands.c I am starting to believe this isn't
possible with the current external commands implementation. I would really
like to continue designing my API as an add-on to Nagios and not something
that requires patching (or replacing) parts of the base system.

Any suggestions on how I would accomplish this? (More background on this at
http://thread.gmane.org/gmane.network.nagios.user/51971)

-Scott Sanders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20080124/08b45abd/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list