Xymon Mailing List Archive search

https via proxy

list Torsten Richter
Thu, 23 Jul 2009 23:47:02 +0200
Message-Id: <user-a67796f13aba@xymon.invalid>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ralph,

thanks for the answer.
The script is working great.

Cheers
Torsten

Ralph Mitchell wrote:
On Thu, Jul 23, 2009 at 8:34 AM, Torsten Richter <user-c862b499d9fa@xymon.invalid> 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 ============
- --
+---------------------------------------------------------+
| Richter IT-Consulting					  |
| E-mail  : user-c862b499d9fa@xymon.invalid			  |
|							  |
| Homepage: http://www.richter-it.net/			  |
+---------------------------------------------------------+
Download my public key from:
http://www.keyserver.net:11371/pks/lookup?op=get&search=0x899093AC
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)

iD8DBQFKaNpW7DlmxomQk6wRArQyAJwITkOoKTZ3Tw+98oGxPxePRoLscACgqfeC
/J6E/ZEfdhtoCFMukpPMUlQ=
=HIjF
-----END PGP SIGNATURE-----