[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Summary/Total data from several hosts



Thanks Henrik,

I just having one small problem now - I can't send the data I get to
hobbit....

Output of the bb query is:
status server1.pusers green Wed Oct  3 12:40:00 UTC 2007\nConnected_Users :
175\n

DSLGWS="^server[12345]\$"
RESULT=0
bb 212.56.225.37 "hobbitdboard host=${DSLGWS} test=pusers fields=msg" | \
while read L
do
                NBUSERS=`echo "$L" | sed 's/.* //g' | sed 's/n//g'`
                RESULT=`expr $RESULT + $NBUSERS`
echo $RESULT
done

echo $RESULT

$BB $BBDISP "status Total-Users.pusers green `date`
Connected_Users : $RESULT
"

The first echo gives me the Total after each while/do ie.
186
370
527
677
839

but the second echo gives me 0. I've tried using export RESULT but can't
seem to be able to get the RESULT outside of the while/do statement.

Darren



                                                                           
             henrik (at) hswn.dk                                                
             (Henrik Stoerner)                                             
                                                                        To 
             03/10/2007 13:08          hobbit (at) hswn.dk                      
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
              hobbit (at) hswn.dk           Re: [hobbit] Summary/Total data     
                                       from several hosts                  
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




On Wed, Oct 03, 2007 at 11:36:49AM +0200, Darren.Cotton (at) ses-astra.com
wrote:
>
> 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:

I'd use the hobbitdboard query against the server:

DSLGWS="^server[12345]\$"
RESULT=0
bb 127.0.0.1 "hobbitdboard host=${DSLGWS} test=pusers fields=msg" | \
while read L
do
             NBUSERS=...whatever is needed to grab the number...
             RESULT=`expr $RESULT + $NBUSERS`
done

Grabbing data from the checkpoint file suffers from the fact that by
default it is only updated once every 15 minutes, so it takes a long
time for changes to filter through to that file. By using the
hobbitdboard command, you always get the latest data that Hobbit has.


Regards,
Henrik


To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk





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.