command file problem

Demetri Mouratis dmourati at cm.math.uiuc.edu
Tue May 25 03:35:32 CEST 2004


On Mon, 24 May 2004, Ballowe, Charles wrote:

> I've got a little issue -- I'm not sure if it's a bug or if I'm doing
> something wrong. I'm running nagios 1.2 and the comments in the config file
> indicate (as I see) that the external command file goes away after it's
> contents are executed. The cmd.cgi seems to expect it to exist and fails to
> find it and also doesn't bother to create it.

I ran into a similar problem because we had external applications posting
to cmd.cgi (actually our own hacked up version called alarm.cgi).  A race
condition exists if you allow cmd.cgi to write to the non-existant named
pipe.  Think about it like this:

1.	Start Apache
2.	Start Nagios
3.	Stop Nagios
4.	Apache writes to nagios.cmd via cmd.cgi
5.	Start Nagios fails because nagios.cmd exists

Ugh.

NSCA solves this problem by providing an alternate dump file:

# ALTERNATE DUMP FILE
# This is used to specify an alternate file the daemon should
# write service check results to in the event the command file
# does not exist.  It is important to note that the command file
# is implemented as a named pipe and only exists when Nagios is
# running.  You may want to modify the startup script for Nagios
# to dump the contents of this file into the command file after
# it starts Nagios.  Or you may simply choose to ignore any
# check results received while Nagios was not running...

alternate_dump_file=/opt/nagios/var/rw/nsca.dump

I picked the second option and simply chose to ignore and check reults
while Nagios is not running by editting alarm.cgi to check the existence
of nagios.cmd and exiting if the file doesn't exist.

Hope that helps.
---------------------------------------------------------------------
Demetri Mouratis
dmourati at linfactory.com



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list