How to debug a check_http problem?

Sean McAfee smcafee at collaborativefusion.com
Tue Oct 14 17:54:30 CEST 2008


Götz Reinicke wrote:
> Hi,
>
> recently I noticed, that checking some virtual http services fails.
>
> If I launch the check_http command by hand, I do get a "HTTP OK" message.
>
> If the check is launched by nagios, it fails with an "HTTP WARNING:
> HTTP/1.1 404 Not Found" message.
>   
In situations like this, the problem is usually either permissions or a 
misconfiguration in templates/check_commands so the first step is always 
to enable debugging.  This will allow you to get the actual 
macro-expanded command that Nagios is trying to execute:

[1223999444.193398] [2048.1] [pid=44166] **** BEGIN MACRO PROCESSING 
***********
[1223999444.193410] [2048.1] [pid=44166] Processing: 
'$USER1$/check_nrpe2 -H $HOSTADDRESS$ -c check_nagios_status -a "$ARG1$"'
[1223999444.193424] [2048.2] [pid=44166]   Processing part: ''
[1223999444.193437] [2048.2] [pid=44166]   Not currently in macro.  
Running output (0): ''
[1223999444.193450] [2048.2] [pid=44166]   Processing part: 'USER1'
[1223999444.193473] [2048.2] [pid=44166]   Processed 'USER1', Clean 
Options: 0, Free: 0
[1223999444.193486] [2048.2] [pid=44166]   Processed 'USER1', Clean 
Options: 0, Free: 0
[1223999444.193504] [2048.2] [pid=44166]   Cleaning options: global=0, 
local=0, effective=0
[1223999444.193519] [2048.2] [pid=44166]   Uncleaned macro.  Running 
output (25): '/usr/local/libexec/nagios'
[1223999444.193532] [2048.2] [pid=44166]   Just finished macro.  Running 
output (25): '/usr/local/libexec/nagios'
[1223999444.193545] [2048.2] [pid=44166]   Processing part: 
'/check_nrpe2 -H '
[1223999444.193559] [2048.2] [pid=44166]   Not currently in macro.  
Running output (41): '/usr/local/libexec/nagios/check_nrpe2 -H '
[1223999444.193571] [2048.2] [pid=44166]   Processing part: 'HOSTADDRESS'
[1223999444.193585] [2048.2] [pid=44166]   macro_x[2] (HOSTADDRESS) match.
[1223999444.193601] [2048.2] [pid=44166]   Processed 'HOSTADDRESS', 
Clean Options: 0, Free: 1
[1223999444.193614] [2048.2] [pid=44166]   Processed 'HOSTADDRESS', 
Clean Options: 0, Free: 1
[1223999444.193627] [2048.2] [pid=44166]   Cleaning options: global=0, 
local=0, effective=0
[1223999444.193642] [2048.2] [pid=44166]   Uncleaned macro.  Running 
output (97): '/usr/local/libexec/nagios/check_nrpe2 -H foo.domain.com'
[1223999444.193655] [2048.2] [pid=44166]   Just finished macro.  Running 
output (97): '/usr/local/libexec/nagios/check_nrpe2 -H foo.domain.com'
[1223999444.193668] [2048.2] [pid=44166]   Processing part: ' -c 
check_nagios_status -a "'
[1223999444.193681] [2048.2] [pid=44166]   Not currently in macro.  
Running output (125): '/usr/local/libexec/nagios/check_nrpe2 -H 
foo.domain.com -c check_nagios_status -a "'
[1223999444.193778] [2048.2] [pid=44166]   Processing part: 'ARG1'
[1223999444.193795] [2048.2] [pid=44166]   Processed 'ARG1', Clean 
Options: 0, Free: 0
[1223999444.193808] [2048.2] [pid=44166]   Processed 'ARG1', Clean 
Options: 0, Free: 0
[1223999444.193821] [2048.2] [pid=44166]   Cleaning options: global=0, 
local=0, effective=0
[1223999444.193834] [2048.2] [pid=44166]   Uncleaned macro.  Running 
output (126): '/usr/local/libexec/nagios/check_nrpe2 -H foo.domain.com 
-c check_nagios_status -a "2'
[1223999444.193848] [2048.2] [pid=44166]   Just finished macro.  Running 
output (126): '/usr/local/libexec/nagios/check_nrpe2 -H foo.domain.com 
-c check_nagios_status -a "2'
[1223999444.193861] [2048.2] [pid=44166]   Processing part: '"'
[1223999444.193874] [2048.2] [pid=44166]   Not currently in macro.  
Running output (127): '/usr/local/libexec/nagios/check_nrpe2 -H 
foo.domain.com -c check_nagios_status -a "2"'
[1223999444.193887] [2048.1] [pid=44166]   Done.  Final output: 
'/usr/local/libexec/nagios/check_nrpe2 -H foo.domain.com -c 
check_nagios_status -a "2"'
[1223999444.193899] [2048.1] [pid=44166] **** END MACRO PROCESSING 
*************

The second to last line (Final output:) contains the exact command that 
Nagios executed.  Running this from the command line (as the Nagios 
user!) will go a long way toward helping you figure out the problem.

-- 
Sean McAfee
System Engineer

Collaborative Fusion, Inc.
 smcafee at collaborativefusion.com
 412-422-3463 x 4025

5849 Forbes Avenue
Pittsburgh, PA 15217

****************************************************************
IMPORTANT: This message contains confidential information
and is intended only for the individual named. If the reader of
this message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.
****************************************************************




IMPORTANT: This message contains confidential information and is intended only for the individual named. If the reader of this message is not an intended recipient (or the individual responsible for the delivery of this message to an intended recipient), please be advised that any re-use, dissemination, distribution or copying of this message is prohibited. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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