[xymon] os count with graph

David Baldwin david.baldwin at ausport.gov.au
Tue Sep 21 09:07:44 CEST 2010


All you need is this 'one liner' for the count of each version:

bbcmd bbhostshow | egrep '^[1-9][0-9]*\.' | awk '{print $2}' | sort -u |
xargs -I{} bb localhost "clientlog {} section=osversion" | sort | uniq
-c | egrep -v '^[[:space:]]*[0-9]+( \[osversion\]|[[:space:]]*$)'

Look! No temporary files! (Pet hate of mine ;)

David.
> How does a wget call compare to using the bb command?
>
> I replaced the wget with:
>     $BBHOME/server/bin/bb localhost "clientlog $HOSTNAME
> section=osversion" | grep -v osversion > $HOSTNAME
>
> and the OSVER with:
>    OSVER=$(sed -e :a -e 's/<[^>]*>//g;/</N;//ba' $HOSTNAME)
>
>
>
> On Mon, Sep 20, 2010 at 9:33 AM, Vernon Everett
> <everett.vernon at gmail.com <mailto:everett.vernon at gmail.com>> wrote:
>
>     Bugger!
>     Was pretty busy today, and completely forgot.
>
>     Here's something that will help.
>     #!/bin/ksh
>     export BBHOME=/usr/lib/hobbit
>     typeset -L20 HOST
>     mkdir -p /usr/lib/hobbit/custom/data
>     cd /usr/lib/hobbit/custom/data
>     INCLUDES=$(grep ^include /etc/hobbit/bb-hosts | awk '{ print $2 }')
>     cat /etc/hobbit/bb-hosts $INCLUDES | egrep -h -v
>     "^#|^page|^$|^title|^subpage|^group|^include" | awk '{ print $2 }' \
>        | sort | uniq \
>        | while read HOSTNAME
>          do
>             wget -O $HOSTNAME -o /dev/null
>     http://hobbit/hobbit-cgi/bb-hostsvc.sh\?HOST\=$HOSTNAME\&SERVICE\=info
>     <http://hobbit/hobbit-cgi/bb-hostsvc.sh%5C?HOST%5C=$HOSTNAME%5C&SERVICE%5C=info>
>     &
>          done
>     wait
>     for HOSTNAME in /usr/lib/hobbit/custom/data/*
>     do
>        OSVER=$(grep OS: $HOSTNAME | sed 's/OS://g'| sed -e :a -e
>     's/<[^>]*>//g;/</N;//ba')
>        HOST=$(basename $HOSTNAME)
>        echo "$HOST    $OSVER"
>     done
>     rm /usr/lib/hobbit/custom/data/*
>
>     This will generate a list of hosts, and OS version.
>     You want a list of number of OS versions, pipe the output to awk
>     '{ print $2 }' | sort | uniq -c | awk '{ print $2":"$1}
>     You can feed this back to Hobbit using bb, as a test and graph it.
>
>     I recommend you use stack graphs for more interesting looking graphs.
>
>     Let me know how you go.
>
>     Regards
>          Vernon
>
>
>
>
>     On Mon, Sep 20, 2010 at 8:25 PM, Martin Flemming
>     <martin.flemming at desy.de <mailto:martin.flemming at desy.de>> wrote:
>
>
>             Got some code stubs I can post later when I get to work.
>
>
>         That's will be great :-)
>
>         thanks & cheers,
>
>           martin
>
>
>         On Mon, 20 Sep 2010, Vernon Everett wrote:
>
>             Easy enough to knock together.
>             Read it out of the server, then feed it back.
>
>             Got some code stubs I can post later when I get to work.
>
>             Cheers
>                V
>
>
>             On Sun, Sep 19, 2010 at 1:47 AM, Martin Flemming
>             <martin.flemming at desy.de <mailto:martin.flemming at desy.de>>
>             wrote:
>
>                  Hi !
>
>                  Got somebody an working script for counting OS of
>             alle clients
>                  ( RHEl3/4/5 Solaris .5.8/5.19./5.10 etc ..) with
>             graphing .. ?
>
>                  I know some old threads about that request,
>                  But hey didn't really work for me are without graphs
>             .. :-(
>
>                  thanks & cheers,
>
>
>                        Martin
>
>
>                  To unsubscribe from the xymon list, send an e-mail to
>                  xymon-unsubscribe at xymon.com
>             <mailto:xymon-unsubscribe at xymon.com>
>
>
>         To unsubscribe from the xymon list, send an e-mail to
>         xymon-unsubscribe at xymon.com <mailto:xymon-unsubscribe at xymon.com>
>
>
>


-- 
David Baldwin - IT Unit
Australian Sports Commission          www.ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
david.baldwin at ausport.gov.au          Leverrier Street Bruce ACT 2617


-------------------------------------------------------------------------------------
Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
-------------------------------------------------------------------------------------



More information about the Xymon mailing list