Need help with check_http

Rob Hamilton rob at lotame.com
Fri Jul 27 19:57:24 CEST 2007


Hey Mark,

Thanks for the great response.

My nagios check_http plugin seems to be a bit newer than yours. I'm
using Nagios V2.9 with what appears to be newer plugins.

[root at hydra libexec]# ./check_http -V
check_http (nagios-plugins 1.4.9) 1.104


Here are the test cases. All exit codes look to be correct on command
completion (0,2,2 respectively), but when I use the echo $? command -
they are all zeros  (see below).

Cases below...

Thanks,

-Rob

Case: Apache up, JBoss up

[root at hydra libexec]# ./check_http -e OK -H <virtualhost> -I app10 -u
<testurl>
[1] 4332
[root at hydra libexec]# HTTP OK HTTP/1.1 200 OK - 609 bytes in 0.134
seconds |time=0.134439s;;;0.000000 size=609B;;;0
[1]+  Done                    ./check_http -e OK -H <virtualhost> -I
app10 -u <testurl>
[root at hydra libexec]# echo $?
0


Case: Apache down, JBoss up

[root at hydra libexec]# ./check_http -e OK -H <virtualhost> -I app10 -u
<testurl>
[1] 4411
[root at hydra libexec]# Connection refused
HTTP CRITICAL - Unable to open TCP socket
[1]+  Exit 2                  ./check_http -e OK -H <virtualhost> -I
app10 -u <testurl>
[root at hydra libexec]# echo $?
0


Case: Apache up, JBoss down

[root at hydra libexec]# ./check_http -e OK -H <virtualhost> -I app10 -u
<testurl>
[1] 4431
[root at hydra libexec]# HTTP CRITICAL - Invalid HTTP response received
from host
[1]+  Exit 2                  ./check_http -e OK -H <virtualhost> -I
app10 -u <testurl>
[root at hydra libexec]# echo $?
0

-----Original Message-----
From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Marc
Powell
Sent: Friday, July 27, 2007 12:28 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Need help with check_http



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Rob Hamilton
> Sent: Friday, July 27, 2007 10:58 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Need help with check_http
> 
> 
> 
> The check_http plugin doesn't seem to be catching critical events and
> connection refused events:


> When apache is off, I get a "Connection refused"  in the status
> information, but the nagios status for the defined service is "OK"
> 
> 
> 
> When apache is up and the app server is down, I get "HTTP CRITICAL -
> Invalid HTTP response received from host " in the status information,
but
> the nagios status for the defined service is "OK"
> 
> 
> 
> When I run check_http from the command line manually, I can confirm
that
> I'm receiving correct status information back and the expect string of
> "OK" isn't in the response.
> 
> 
> 
> What am I missing?

The nagios status is not derived from the text output but rather the
exit code of the plugin. When testing from the command line, use 'echo
$?' to verify the exit code of the plugin. 0 = OK, 1 = Warning, 2 =
Critical. The symptoms you are reporting indicate that the exit code
isn't being set properly or isn't being seen by nagios properly.

I've confirmed that it should work as specified by you, at least with a
slightly older version of check_http. Are you seeing the proper exit
code from the plugin? --

$ ./check_http -e OK -H www.somehost.com -I myip.address -u /foo
Invalid HTTP response received from host
$ echo $?
2

$ ./check_http -e OK -H www.somehost.com -I myip.address -u /foo
Connection refused
Unable to open TCP socket
$ echo $?
2

$ ./check_http -V
check_http (nagios-plugins 1.4.3) 1.89

If nagios isn't seeing the exit code properly, that would be a rather
unique situation. I can't recall seeing that before.

--
Marc

------------------------------------------------------------------------
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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

The information transmitted in this email is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and permanently delete the email from any computer. 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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