Xymon Mailing List Archive search

xymon-rclient

list Jeremy Laidman
Thu, 7 Aug 2014 00:39:11 +1000
Message-Id: <CAAnki7CQHs=user-e3878e29d4d5@xymon.invalid>

OK, so this is what I'd do.
subpage vips VIPS
10.218.160.150   server1 #foo
10.218.160.150   server2 #foo
The "foo" would not normally be needed, but let's assume that you want your
script to work out what hosts to probe. So we'll leave it in.
I want to send xml through this call:

wget --post-file=SentinelCompReport.xml --header="Content-Type: text/xml"
--header="SOAPAction: \"http://xxx.com/ComprehensivePersonSearch\""; -O -
http://VIP/BobService.asmx

I'd put this in a script like so:

#!/bin/sh

TESTNAME="foo"
REGEX="some regex"

do_fetch() {
    wget ... --header="SOAPAction: \"http://$1/ComprehensivePersonSearch\";
-O - http://$2/BobService.asmx
}

$BBHOME/bin/bbhostgrep foo | while read IP HOSTNAME OTHER; do
    if do_fetch $HOSTNAME $IP | grep "$REGEX" > /dev/null ; then
        COL=green
        MSG="Test for $TESTNAME is OK"
    else
        COL=red
        MSG="Test for $TESTNAME failed"
    fi
    $BB $BBDISP "status $HOSTNAME.$TESTNAME $COL `date` $MSG"
done

This is from memory and hasn't been tested, but should give you the gist.

J