Verion 2.0b4 how does cgi's nagios_check_command work?
John P. Rouillard
rouilj at cs.umb.edu
Thu Oct 6 22:58:24 CEST 2005
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?
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?
There is a variable nagios_process_state that seems to be set
unconditionally to STATE_OK that would be set to the output state of
the check_nagios_command. Grepping through the source tree turns up lots of
comparisons, but only the two assignments.
Assignments
cgiutils.c:int nagios_process_state=STATE_OK;
cgiutils.c: nagios_process_state=STATE_OK;
Use/declarations
cgiutils.c: if(nagios_process_state!=STATE_OK)
cmd.c:extern int nagios_process_state;
extinfo.c:extern int nagios_process_state;
extinfo.c: if(nagios_process_state==STATE_OK){
extinfo.c: if(nagios_process_state==STATE_OK){
extinfo.c: else if(nagios_process_state==STATE_WARNING){
extinfo.c: else if(nagios_process_state==STATE_CRITICAL){
extinfo.c: if(nagios_process_state==STATE_OK){
extinfo.c: if(nagios_process_state==STATE_OK){
extinfo.c: if(nagios_process_state==STATE_OK){
extinfo.c: if(nagios_process_state==STATE_OK){
statuswml.c:extern int nagios_process_state;
statuswml.c: if(nagios_process_state==STATE_OK)
tac.c:extern int nagios_process_state;
Also the default nagios_check_command define in the sample cgi.cfg
looks for the file:
status.dat
but that has dumped status info, and the check_nagios command (from
the 1.4 plugins) can't understand it. It looks like it should be
looking for the log file: nagios.log. When run using the nagios.log
file the expected result is returned.
So thoughts, quips, comments or questions?
-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
-------------------------------------------------------
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