results page not showing the whole output
I have a server side script which does a wget call to each server that needs to be tested -- many nodes. The tests does a wget call and if the return data is good, then it's green and if it's bad, it turns red. When it turns green or red, I want the output echoed to the web page. However, it is outputting only the result of one xml tag called the <EchoTestResult>
So, my green results web page ONLY outputs 'TESTBOB', rather then the whole XML -- I want the whole xml on the results page.
Below, here is the script: !/bin/sh -x
TESTNAME="BobProd" REGEXP="TESTBOB"
CAT=/bin/cat WGET=/usr/bin/wget GREP=/bin/grep REMOVE=/bin/rm
do_fetch() { wget --post-file=/usr/lib/xymon/server/ext/echotest.xml --header="Content-Type: text/xml" --header="SOAPAction: \"http://xxx.com/EchoTest\"" -O - http://$2/xxxxxx.asmx | tee /tmp/rodney.txt }
FILE="/tmp/rodney.txt"
$BBHOME/bin/bbhostgrep "$TESTNAME" | while read IP HOSTNAME OTHER; do if do_fetch "$HOSTNAME" "$IP" | grep "$REGEXP" > /dev/null ; then OUT="$(cat "$FILE")" COL=green MSG="${OUT}"
else OUT="$(cat "$FILE")" COL=red MSG="${OUT}" fi
$BB $BBDISP "status $HOSTNAME.$TESTNAME $COL date
$MSG"
$REMOVE "$FILE"
done
Here is the output from the logs -- it is outputting the whole xml:
- cat /tmp/rodney.txt
- OUT=<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><EchoTestResponse xmlns="http://xxx.com/"><EchoTestResult>TESTBOB</EchoTestResult></EchoTestResponse></soap:Body></soap:Envelope>
- COL=green
- MSG=<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><EchoTestResponse xmlns="http://xxx.com/"><EchoTestResult>TESTBOB</EchoTestResult></EchoTestResponse></soap:Body></soap:Envelope>
- date
- /usr/lib/xymon/server/bin/xymon 10.xxx.xxxx.xxx status 10.218.161.77.BobProd green Sat Aug 30 09:15:50 EDT 2014 <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><EchoTestResponse xmlns="http://xxx.com/"><EchoTestResult>TESTBOB</EchoTestResult></EchoTestResponse></soap:Body></soap:Envelope>
- /bin/rm /tmp/rodney.txt
Any help will be greatly appreciated on why I can't get the whole xml on the results page.
~
participants (1)
-
usaims@yahoo.com