[Nagios-users] Need help with check_http
The check_http plugin doesn't seem to be catching critical events and connection refused events: Localhost.cfg define service{ use local-service ; Name of service template to use host_name app3, app4, app5, app6, app7, app8, app9, app10, service_description CC_PIXEL check_command check_pixel } Commands.cfg # 'check_pixel' command definition define command{ command_namecheck_pixel command_line$USER1$/check_http -e OK -H virtual hostname -I $HOSTADDRESS$ -u test url} 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? Thanks, -Rob 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@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
Re: [Nagios-users] Need help with check_http
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. [EMAIL PROTECTED] 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 [EMAIL PROTECTED] libexec]# ./check_http -e OK -H virtualhost -I app10 -u testurl [1] 4332 [EMAIL PROTECTED] libexec]# HTTP OK HTTP/1.1 200 OK - 609 bytes in 0.134 seconds |time=0.134439s;;;0.00 size=609B;;;0 [1]+ Done./check_http -e OK -H virtualhost -I app10 -u testurl [EMAIL PROTECTED] libexec]# echo $? 0 Case: Apache down, JBoss up [EMAIL PROTECTED] libexec]# ./check_http -e OK -H virtualhost -I app10 -u testurl [1] 4411 [EMAIL PROTECTED] libexec]# Connection refused HTTP CRITICAL - Unable to open TCP socket [1]+ Exit 2 ./check_http -e OK -H virtualhost -I app10 -u testurl [EMAIL PROTECTED] libexec]# echo $? 0 Case: Apache up, JBoss down [EMAIL PROTECTED] libexec]# ./check_http -e OK -H virtualhost -I app10 -u testurl [1] 4431 [EMAIL PROTECTED] libexec]# HTTP CRITICAL - Invalid HTTP response received from host [1]+ Exit 2 ./check_http -e OK -H virtualhost -I app10 -u testurl [EMAIL PROTECTED] libexec]# echo $? 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Powell Sent: Friday, July 27, 2007 12:28 PM To: nagios-users@lists.sourceforge.net Subject: Re: [Nagios-users] Need help with check_http -Original Message- From: [EMAIL PROTECTED] [mailto:nagios-users- [EMAIL PROTECTED] On Behalf Of Rob Hamilton Sent: Friday, July 27, 2007 10:58 AM To: nagios-users@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@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
Re: [Nagios-users] Need help with check_http
What was it ... D'oh! Thanks for the eyeballs Marc... -Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Powell Sent: Friday, July 27, 2007 2:21 PM To: nagios-users@lists.sourceforge.net Subject: Re: [Nagios-users] Need help with check_http -Original Message- From: [EMAIL PROTECTED] [mailto:nagios-users- [EMAIL PROTECTED] On Behalf Of Rob Hamilton Sent: Friday, July 27, 2007 12:57 PM To: Marc Powell Cc: nagios-users@lists.sourceforge.net Subject: Re: [Nagios-users] Need help with check_http 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. [EMAIL PROTECTED] 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 [EMAIL PROTECTED] libexec]# ./check_http -e OK -H virtualhost -I app10 -u testurl [1] 4332 [EMAIL PROTECTED] libexec]# HTTP OK HTTP/1.1 200 OK - 609 bytes in 0.134 seconds |time=0.134439s;;;0.00 size=609B;;;0 [1]+ Done./check_http -e OK -H virtualhost -I app10 -u testurl [EMAIL PROTECTED] libexec]# echo $? 0 Yes, it's clear what's going on now... Your testurl contains an '', doesn't it? This causes the part of the command before the to be executed as a detached process in the background and the rest is likely just creating shell variable=value environment variables. It's this latter successful variable assignment that's exiting with status code 0. The success or failure of the first part is irrelevant. A simple example is below -- $ echo something1=somethingsomething2=somethingelse [1] 22997 Something1=something [1]+ Doneecho something1=something $ echo $? 0 $ echo $something2 somethingelse Using the -v argument to check_http you can see the difference in the GET requests as well. It has a simple solution though: enclose the testurl in quotes in your command definition. If you were testing on the command line you'd use -- ./check_http -e OK -H virtualhost -I app10 -u testurl -- 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@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@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