Summary/Total data from several hosts

Darren.Cotton at ses-astra.com Darren.Cotton at ses-astra.com
Wed Oct 3 11:36:49 CEST 2007


I have 5 hosts on which I have script monitoring connected users. This is
then sent to hobbit and as a result I have 5 separate entries which I then
want to total on the server.

Currently I am parsing the tmp file to get the number of users as follows:

DSLGWS="server1 server2 server3 server4 server5"
SERVICE=Total-Users
BBPROG=bb-pusers.sh; export BBPROG
RESULT=0
COLOR="clear"
BBTMP="/usr/lib/hobbit/server/tmp"
for USERS in $DSLGWS
do
        if [ -f $BBTMP/hobbitd.chk ]; then
                NBUSERS=`cat $BBTMP/hobbitd.chk | grep pusers | grep $USERS
| sed 's/.*: //g' | tr -d '\\' | sed 's/n.*//g' | bc`
                RESULT=`echo "$RESULT+$NBUSERS" | bc`
        else
                echo "Unable to find "$BBTMP/hobbitd.chk" Sending 0 total
users"
                RESULT=0
        fi
done

MACHINE=$SERVICE

$BB $BBDISP "status $MACHINE.pusers $COLOR `date`
Connected_Users : $RESULT
"

Now this works but I think it is an ugly way of going about it - Is there
another simpler/better way of going about this that I cant see.



DISCLAIMER: 
This e-mail contains proprietary information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail.



More information about the Xymon mailing list