Xymon Mailing List Archive search

xymon-rclient

list Jeremy Laidman
Thu, 7 Aug 2014 06:18:51 +1000
Message-Id: <user-3b39c8a151ca@xymon.invalid>

On 07/08/2014 5:14 AM, "Simioni, Rodney" <user-3ffedc1f4d0c@xymon.invalid> wrote:
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
Sorry, I didn't mean to "out" you. ;-)
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"
Ah, I see.
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?
Correct.
Also, your script indicated "$BBHOME/bin/bbhostgrep foo | while read IP
HOSTNAME OTHER; do"

The labels "IP", "HOSTNAME" and "OTHER" are labels used by the "read"
command.  What "read" will do is to read one line from stdin and split it
on whitespace into 3 variables. (The output from the bbhostgrep command is
piped as stdin to the while loop to appear, one line at a time, as input to
"read".)  The 3 variables are dynamically created as per the names (ie $IP,
$HOSTNAME and $OTHER). We use OTHER to catch the rest of each line.

To understand a bit better, try this:

echo "a b c d e" | while read X Y Z; do echo "[$X][$Y][$Z]"; done

Then this:

cat /etc/hosts | while read X Y Z; do echo "[$X][$Y][$Z]"; done
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?

The value of $HOSTNAME will get the second word in the bb-hosts file. I
could have used X, Y, Z instead of IP, HOSTNAME, OTHER, but the code
wouldn't have been as readable.
So, if my assumptions are correct, how should I correct this script you
wrote to reflect my environment.
I think you would just change the $1 to the domain in your URL. Something
like

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

J