[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] https via proxy



On Thu, Jul 23, 2009 at 8:34 AM, Torsten Richter <bb4 (at) richter-it.net> wrote:

> Hi all,
>
> as I've seen in the TODO testing https connections via a proxy is still
> under development.
> Does someone already have solution maybe with a script and curl that she/he
> wants to share?



Here's something I wrote to the mailing list on 11/24/08:

"If that one was useful, here's something that may be a bit better.  I added
a timeout for curl, otherwise it'll wait for a long time if the server
doesn't respond.  Also, this format produces a message formatted just like
Xymon's internal http test, including the time taken to grab the headers.
You could extract the "Seconds" line to determine if the response is a bit
slow.  With a bit more magic in Xymon's configs, you could even graph it..."


As far as curl is concerned, the url can be http:// or https://    -  you
don't need to do anything special.

Ralph Mitchell


============= cut here ============
#!/bin/sh

TESTHOST=www.google.com
TESTURL=https://$TESTHOST/

TIMEOUT=30

# Grab *just* the headers, simulating Xymon's builtin http check
MESSAGE=`curl -x http://ourproxy.ourdomain.com:8080 \     --proxy-anyauth -U
hobbituser:hobbitpassword \
     -m $TIMEOUT \
     -w 'Seconds:     %{time_total}\n' \
     -s -S -L -I $TESTURL | $GREP -v Set-Cookie`
if [ "$?" -eq "0" ]; then
  COLOR=green
else
  COLOR=red
fi

# convert dots to commas in the hostname
MACHINE=`echo $TESTHOST | $SED -e 's/\./\,/g'`

$BB $BBDISP "status $MACHINE.home $COLOR `date`

$MESSAGE"
============= cut here ============