Xymon Mailing List Archive search

bbd purple

list Wayne Gemmell
Mon, 21 Jan 2008 12:01:54 +0200
Message-Id: <user-91db9425eda7@xymon.invalid>

Its monitoring our USSD services. Its also very much hacked from the example. 
I an having problems atm with the while loop but they weren't there when I 
posted my first message. I've pasted it below. Thanks for the help.

#!/bin/bash
BBHTAG=servicemon  # What we put in bb-hosts to trigger this test
COLUMN=servicemon # Name of the column, often same as tag in bb-hosts

echo "Starting: "
$BBHOME/bin/bbhostgrep $BBHTAG | while read L
do
        set $L  # To get one line of output from bbhostgrep
        HOSTIP="$1"
        MACHINEDOTS="$2"
        MACHINE=`echo $2 | $SED -e's/\./,/g'`
        echo $MACHINE
        echo `date`
        COLOR=green
        TMPFILE=/tmp/servicemon$RANDOM.tmp
        echo $TMPFILE
        MSG="$BBHTAG status for host $MACHINEDOTS"
        echo $MSG
        #... do the test, perhaps modify COLOR and MSG
        nc odin 8013 < $BBHOME/ext/ussdMtn.xml > $TMPFILE
        while [ ! `grep "<code>1" $TMPFILE` ] || [ ! `grep "<code>2" 
$TMPFILE` ];do
                nc odin 8013 < $BBHOME/ext/ussdMtn.xml > $TMPFILE
                sleep 5
        done

        if [ ! `grep iZone $TMPFILE` ];then
                COLOR=red
                MSG="mtn is down!!!"
        fi
        nc odin 8013 < $BBHOME/ext/ussdMtnEnd.xml > /dev/null
        rm $TMPFILE
        $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` ${MSG}"
        echo '$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` ${MSG}"'
done
exit 0


On Monday 21 January 2008 11:52:01 Josh Luthman wrote:
What custom script is it?

On 1/21/08, Wayne <user-dbaa221d03d2@xymon.invalid> wrote:
On Monday 21 January 2008 11:20:16 Josh Luthman wrote:
Sounds to me like that script isn't reporting. What custom script is
it? Is it client or server?
server.

Cheers
Wayne