[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] Testing external web through a proxy
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] Testing external web through a proxy
- From: "Ralph Mitchell" <ralphmitchell (at) gmail.com>
- Date: Mon, 24 Nov 2008 10:04:14 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=ztDYm830DLauuTdap9E6QKgyBw8nEfHHkakjvmjQxFU=; b=OhRBWVUxr692QTgGOW1x7eleTjVivi2z0IDWWg+u1fb9E4+pRBellLayQi0dgLRKWL XPGl9U3oce7+Bznf2o6Hgqz4uDLMfOuJzF/4K/D1tba7l1X+fkIEP9q1lnigUZE3CDBT oEJOQjxWsKMSdMhv6GSjsnchkvCnKMHYDV+/c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=gXdF33x0QaoIvDWj70KiAafoO0R8aoCH75vIFj7UvR5w33KuyLDGdFzsxKnrYfQ7sF imIjHOLZ2LaOErH6TfAUyFNUUKwf6RScdCmY95qtk71x1AqelN1ccu3S0pdCg/3bu32l m7rzz8Y3yhQfT+iNZKztmGPhAEoPq+faPUPHM=
- References: <997a524e0811210723h781e3421ka656169cdccb3b9a (at) mail.gmail.com> <A3D12FAD74FC8B46991703F40C182BABAB0778C5 (at) permls102.wde.woodside.com.au>
Heh - dude, that wasn't supposed to be the *whole* script... :)
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...
Ralph Mitchell
============= cut here ============
#!/bin/sh
TESTHOST=www.google.com
TESTURL=http://$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 ============
On Sun, Nov 23, 2008 at 9:04 PM, Everett, Vernon <
Vernon.Everett (at) woodside.com.au> wrote:
> Hi Ralph
>
> This script works a treat.
>
> Thanks
> Vernon
>
> ------------------------------
> *From:* Ralph Mitchell [mailto:ralphmitchell (at) gmail.com]
> *Sent:* Saturday, 22 November 2008 12:23 AM
> *To:* hobbit (at) hswn.dk
> *Subject:* Re: [hobbit] Testing external web through a proxy
>
> Looks like your proxy requires authentication via Kerberos or NTLM or
> GSS-Negotiate. Dunno if Xymon can do those. Luckily the curl tool
> (httpp://curl.haxx.se) *can* do those... I haven't had to use them, but
> it should not be too hard to bang out an ext script to do the check.
> Something along these lines:
>
> #!/bin/sh
> curl -x http://ourproxy.ourdomain.com:8080 \
> --proxy-anyauth -U hobbituser:hobbitpassword \
> -s -S -L -o /dev/null http://www.google.com/
> if [ "$?" -eq "0" ]; then
> COLOR=green
> MESSAGE="Pinged Google OK"
> else
> COLOR=RED
> MESSAGE="Failed to reach Google"
> fi
> $BB $BBDISP "status www,google,com.home $COLOR `date`
> $MESSAGE"
>
> Obviously that can be expanded quite a lot... :) Drop it somewhere on
> your Xymon server (maybe in server/ext) and set up a block in
> server/etc/hobbitlaunch.cfg to fire it off as often as you want. You may
> need to give the full path for curl, which is probably /usr/bin/curl.
>
> Ralph Mitchell
>
>
> On Fri, Nov 21, 2008 at 1:30 AM, Everett, Vernon <
> Vernon.Everett (at) woodside.com.au> wrote:
>
>> Hi all
>>
>> I am trying to test our interent connectivity by checking Google through
>> our proxy.
>> (Once I get this right, I want to start testing some of our external web
>> pages in the same manner)
>>
>> I have configured this in bb-hosts
>> 0.0.0.0 *www.google.com* <http://www.google.com> #
>> noconn *
>> http://hobbituser:hobbitpassword (at) ourproxy.ourdomain.com:8080/http://www.google.com
>> *<http://hobbituser:hobbitpassword (at) ourproxy.ourdomain.com:8080/http://www.google.com>
>>
>> And I get this.
>> *yellow* <http://hobbit/hobbit/gifs/yellow.gif> *
>> http://www.google.com.au/* <http://www.google.com.au/> - Proxy
>> Authentication Required
>>
>> HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires
>> authorization to fulfill the request. Access to the Web Proxy filter is
>> denied. )
>> Via: 1.1 PXYHOSTNAME
>> Proxy-Authenticate: Negotiate
>> Proxy-Authenticate: Kerberos
>> Proxy-Authenticate: NTLM
>> Connection: Keep-Alive
>> Proxy-Connection: Keep-Alive
>> Pragma: no-cache
>> Cache-Control: no-cache
>> Content-Type: text/html
>> Content-Length: 4118
>>
>> Seconds: 0.02
>>
>> Any assistance appreciated.
>>
>> Regards
>> Vernon
>>
>>
>> NOTICE: This email and any attachments are confidential.
>> They may contain legally privileged information or
>> copyright material. You must not read, copy, use or
>> disclose them without authorisation. If you are not an
>> intended recipient, please contact us at once by return
>> email and then delete both messages and all attachments.
>>
>>
> NOTICE: This email and any attachments are confidential.
> They may contain legally privileged information or
> copyright material. You must not read, copy, use or
> disclose them without authorisation. If you are not an
> intended recipient, please contact us at once by return
> email and then delete both messages and all attachments.
>
>