Thank you Jeremy. Allow me to clarify a few things.
I'm not a good sh script guy so I might need you to hold my hand on a few things.
The actual wget call is: wget --post-file=SentinelCompReport.xml --header="Content-Type: text/xml" --header="SOAPAction: \"http://tlo.com/ComprehensivePersonSearch\"" -O - http://<some vip>/BobService.asmx
On the previous email, I put 'xxx.com' instead of tlo.com in the wget call because I didn't want to broadcast my domain name to the world but I don't mind anymore -- so every wget call with have "http://tlo.com/ComprehensivePersonSearch" but on the last http url call it should have the vip of where I'm sending this xml to; for example "http://vip from bb-host file/BobServices.asmx"
So, If had this in my bb-host file: 10.218.160.150 server1 #foo 10.218.160.151 server2 #foo
The first wget call should look like: wget --post-file=SentinelCompReport.xml --header="Content-Type: text/xml" --header="SOAPAction: \"http://tlo.com/ComprehensivePersonSearch\"" -O - http://10.218.160.150/BobService.asmx
From your script, it said "wget ... --header="SOAPAction: \"http://$1/ComprehensivePersonSearch\" -O - http://$2/BobService.asmx" But I'm guessing since we don't need to change the url for "http://tlo.com/ComprehensivePersonSearch\" we don't need the $1, correct?
Also, your script indicated "$BBHOME/bin/bbhostgrep foo | while read IP HOSTNAME OTHER; do" but HOSTNAME is not what I have defined in bb-hosts, I'm using aliases; for example, 10.218.160.150 is mapped to alias called server1 so I can't use
the alias for HOSTNAME because this command won't work "$BB $BBDISP "status $HOSTNAME.$TESTNAME $COL date $MSG", am I correct to assume this?
So, if my assumptions are correct, how should I correct this script you wrote to reflect my environment. Thanks again, sir.
Rod
From: Xymon [xymon-bounces at xymon.com] on behalf of Jeremy Laidman [jlaidman at rebel-it.com.au] Sent: Wednesday, August 06, 2014 9:39 AM To: Rod Simioni Cc: xymon at xymon.com Subject: Re: [Xymon] xymon-rclient
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