Verion 2.0b4 how does cgi's nagios_check_command work?

Andreas Ericsson ae at op5.se
Fri Oct 7 15:33:20 CEST 2005


John P. Rouillard wrote:
> In message <43465AB9.6020304 at op5.se>,
> Andreas Ericsson writes:
> 
>>John P. Rouillard wrote:
>>
>>>Hi all:
>>>
>>>I have groveled through the cgi files in nagios 2.0b4 and I can't find
>>>any instance of the nagios_check_command actually being executed. Am I
>>>just missing it somewhere?
>>>
>>
>>The nagios_check_command has been incorporated into the cgi's. That's 
>>why the status.dat file has the nagios entry on top.
> 
> 
> So the CGI's report nagios is down if and only if the status.date file
> is missing? That matches what I see when I shut down nagios properly.
> If I shut down nagios I see the "Error: Could not read host and
> service status information!" page in the web interface.
> 
> 
>>>    cgiutils.c load the variable from the config file
>>>    extinfo.c  checks to see if the variable is empty and produces a nice
>>>               little warning if it is.
>>>
>>>but nothing seems to actually execute the command. The reason I ask is
>>>that nagios was down and the cgi's all happily reported that it was
>>>up. Could this be because the host and service status files were
>>>available since the machine crashed?
>>
>>Yes, that's almost certainly it. There is no really good way of 
>>detecting that nagios is actually running unless you're logged in as 
>>root.
> 
> 
> Hmm, I am not sure I follow why you need to be logged in as root.


Because otherwise you shouldn't have access to reading process 
information about another users process.

>  Why
> not stat the status.log file and check to see if its (mtime) timestamp
> is less than the setting of:
> 
> 	status_update_interval*2
> 
> if aggregate_status_updates is enabled? One could also allow a setting
> "freshness_threshold" in cgi.cfg that is the number of seconds/minutes
> old the status.dat file is allowed to be if aggregate_status_updates
> isn't set.
> 

Good idea. Write the code for it and submit a patch.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
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