> -----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.000000 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=something&something2=somethingelse [1] 22997 Something1=something [1]+ Done echo 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