Xymon Mailing List Archive search

randomizing execution of tests

list Ralph Mitchell
Fri, 6 Feb 2009 21:29:25 -0600
Message-Id: <user-22124874dc40@xymon.invalid>

On Fri, Feb 6, 2009 at 4:45 PM, Asif Iqbal <user-6f4b51ac2a40@xymon.invalid> wrote:
On Fri, Feb 6, 2009 at 3:48 PM, Ralph Mitchell <user-00a5e44c48c0@xymon.invalid>
wrote:
I don't think that's possible with Xymon right now, but it can be done if
you're up to a little scripting.  I had an aging, single 733MHz cpu DL380
running web page checkouts on 400+ hosts, generating around 2700 reports,
running at various intervals from 30 seconds to 24 hours.

The trick is to use cron for scheduling...

Something like this, for instance:

============= 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 -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 ============
This curl command looks all I need as an extension script instead of
http:// to get my host specific http timeout

I could just use this instead of urlplus.pl, correct?
Yes, you could do exactly that.  You'll probably want to make the above
script into a function or child script and feed it the hostname, url & max
time values pulled from a file.

Ralph Mitchell