Xymon Mailing List Archive search

os count with graph

11 messages in this thread

list Martin Flemming · Sat, 18 Sep 2010 19:47:02 +0200 (CEST) ·
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
list Vernon Everett · Mon, 20 Sep 2010 07:53:29 +0800 ·
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
quoted from Martin Flemming


On Sun, Sep 19, 2010 at 1:47 AM, Martin Flemming <user-f286aaa49a76@xymon.invalid>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

list Martin Flemming · Mon, 20 Sep 2010 14:25:13 +0200 (CEST) ·
Got some code stubs I can post later when I get to work.
That's will be great :-)

thanks & cheers,

    martin
quoted from Vernon Everett

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 <user-f286aaa49a76@xymon.invalid> 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

list Vernon Everett · Mon, 20 Sep 2010 21:33:58 +0800 ·
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 &
     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
quoted from Martin Flemming


On Mon, Sep 20, 2010 at 8:25 PM, Martin Flemming <user-f286aaa49a76@xymon.invalid>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 <user-f286aaa49a76@xymon.invalid>
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

list Patrick Nixon · Mon, 20 Sep 2010 12:26:33 -0400 ·
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)
quoted from Vernon Everett


On Mon, Sep 20, 2010 at 9:33 AM, Vernon Everett <user-b3f8dacb72c8@xymon.invalid>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>&;
quoted from Vernon Everett
     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 <user-f286aaa49a76@xymon.invalid>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 <
user-f286aaa49a76@xymon.invalid> 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

list Vernon Everett · Tue, 21 Sep 2010 15:02:51 +0800 ·
That'll probably work too.....provided you are only running Windows servers.
For Solaris, you need to use section=uname
Not sure for anything else.

By using wget, you are essentially retrieving the "info" page.
Doesn't matter what OS you are running, you should find the version and some
details next to the string "OS:"
You might still need a little bit of creative massaging to get what you want
into a comparable format, but the basics are there.
It has worked for me in the past.
YMMV.

Regards
     Vernon
quoted from Patrick Nixon


On Tue, Sep 21, 2010 at 12:26 AM, Patrick Nixon <user-1f2406f832af@xymon.invalid> wrote:
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 <user-b3f8dacb72c8@xymon.invalid>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 <user-f286aaa49a76@xymon.invalid
quoted from Patrick Nixon
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 <
user-f286aaa49a76@xymon.invalid> 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

list David Baldwin · Tue, 21 Sep 2010 17:07:44 +1000 ·
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.
quoted from Vernon Everett
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
<user-b3f8dacb72c8@xymon.invalid <mailto:user-b3f8dacb72c8@xymon.invalid>> 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>;
quoted from Vernon Everett
    &
         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
    <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>> 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

            <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>>
quoted from Vernon Everett
            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


            <mailto:xymon-unsubscribe at xymon.com>


        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
user-cbbf693f2c89@xymon.invalid          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.
list Vernon Everett · Tue, 21 Sep 2010 16:29:08 +0800 ·
Very elegant.
And something new for me. I have never used the "bbcmd bbhostshow" command.
It's a much better way of getting the complete contents of all the bb-hosts
with includes.
Every day is a schoolday. :-)

I would suggest one or two improvements though.
egrep '^[1-9][0-9]*\.' doesn't cater for my Wintel hosts which are defined
with IP address 0.0.0.0
We let Xymon use DNS for them, so I dropped the first [1-9].

bb localhost "clientlog {} section=osversion" only works for Wintel.
I changed it to the following
bb localhost "clientlog {} section=osversion,uname"
This will grab the relevant info for Wintel as well as Solaris.

I then need to modify the output for Solaris, because the uname string
includes the hostname.
I eventually ended up with this.
./server/bin/bbcmd bbhostshow | egrep '^[0-9]*\.' \
                              | awk '{print $2}' \
                              | sort -u \
                              | xargs -I{} ./server/bin/bb localhost
"clientlog {} section=osversion,uname" \
                              | grep -v "^\[" \
                              | awk ' $1 == "SunOS" { print $1" "$3" "$4};
$1 != "SunOS" {print} ' \
                              | sort \
                              | uniq -c

That last awk might need to be seriously adapted for other OS types, or
perhaps pipe the output to another similar awk.
(Also, for SunOS, $4 is the patch level. Hack that to print $1" "$3 for OS
version only)

I ended up with output that looked like this
  10 Microsoft  (build 7600)
   2 Microsoft Windows Server 2003 R2, Standard Edition Service Pack 2
(build 3790)
   6 Microsoft Windows Server 2008 , 64-bit Service Pack 2 (build 6002)
   1 SunOS 5.10 Generic_139556-08
   4 SunOS 5.10 Generic_141444-09
  90 SunOS 5.10 Generic_142900-03
Useful?
I have no idea.

And yes, I agree, temp files are bad. But unfortunately, a necessary evil
sometimes.

Cheers
     Vernon


On Tue, Sep 21, 2010 at 3:07 PM, David Baldwin <user-cbbf693f2c89@xymon.invalid
quoted from David Baldwin
wrote:
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
<user-b3f8dacb72c8@xymon.invalid <mailto:user-b3f8dacb72c8@xymon.invalid>> 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>;
    <
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
    <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>> 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
            <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>>
            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

            .. :-(
quoted from David Baldwin

                 thanks & cheers,


                       Martin


            <mailto:xymon-unsubscribe at xymon.com>


        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
user-cbbf693f2c89@xymon.invalid          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.

list Martin Flemming · Tue, 21 Sep 2010 11:26:05 +0200 (CEST) ·
Dear all !

Perfectly .. it works like a charme .. :-)

.. one more question and how get them all in one graph ?

thanks a lot & cherrs,

 	martin
quoted from Vernon Everett


On Tue, 21 Sep 2010, Vernon Everett wrote:
Very elegant.
And something new for me. I have never used the "bbcmd bbhostshow" command.
It's a much better way of getting the complete contents of all the bb-hosts with includes.
Every day is a schoolday. :-)

I would suggest one or two improvements though.
egrep '^[1-9][0-9]*\.' doesn't cater for my Wintel hosts which are defined with IP address 0.0.0.0
We let Xymon use DNS for them, so I dropped the first [1-9].

bb localhost "clientlog {} section=osversion" only works for Wintel.
I changed it to the following
bb localhost "clientlog {} section=osversion,uname"
This will grab the relevant info for Wintel as well as Solaris.

I then need to modify the output for Solaris, because the uname string includes the hostname.
I eventually ended up with this.
./server/bin/bbcmd bbhostshow | egrep '^[0-9]*\.' \
                              | awk '{print $2}' \
                              | sort -u \
                              | xargs -I{} ./server/bin/bb localhost "clientlog {} section=osversion,uname" \
                              | grep -v "^\[" \
                              | awk ' $1 == "SunOS" { print $1" "$3" "$4}; $1 != "SunOS" {print} ' \
                              | sort \
                              | uniq -c

That last awk might need to be seriously adapted for other OS types, or perhaps pipe the output to another similar awk.
(Also, for SunOS, $4 is the patch level. Hack that to print $1" "$3 for OS version only)

I ended up with output that looked like this
  10 Microsoft  (build 7600)
   2 Microsoft Windows Server 2003 R2, Standard Edition Service Pack 2 (build 3790)
   6 Microsoft Windows Server 2008 , 64-bit Service Pack 2 (build 6002)
   1 SunOS 5.10 Generic_139556-08
   4 SunOS 5.10 Generic_141444-09
  90 SunOS 5.10 Generic_142900-03
Useful?
I have no idea.

And yes, I agree, temp files are bad. But unfortunately, a necessary evil sometimes.

Cheers
     Vernon


On Tue, Sep 21, 2010 at 3:07 PM, David Baldwin <user-cbbf693f2c89@xymon.invalid> wrote:
      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
<user-b3f8dacb72c8@xymon.invalid <mailto:user-b3f8dacb72c8@xymon.invalid>> 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
    <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>> 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
            <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>>
            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

            .. :-(
quoted from Vernon Everett

                 thanks & cheers,


                       Martin


            <mailto:xymon-unsubscribe at xymon.com>


        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
user-cbbf693f2c89@xymon.invalid          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.

list Vernon Everett · Tue, 21 Sep 2010 20:50:26 +0800 ·
That's where the fun begins. :-)

Let's call your test name oscount (for lack of imagination on my part)

Send all your data to the server in the server using bb as if it was a
normal test, but make sure your data is in the format
OS-Description-1 : xx
OS-Description-2 : yy
etc.etc

You then add oscount=ncv to TEST2RRD= in hobbitserver.cfg and add oscount to
GRAPHS=
Same as we do for any new test. See examples on Xymonton

Then you also add in hobbitserver.cfg
SPLITNCV_oscount="*:GAUGE"

Remember to restart your server.

Creating graph definitions with SPLITNCV is easy.
Add this to hobbitgraph.cfg

[oscount]
  FNPATTERN oscount,(.*).rrd
  TITLE Number of instances of OS
  YAXIS Number
  -l 0
  DEF:p at RRDIDX@=@RRDFN@:lambda:AVERAGE
  LINE2:p at RRDIDX@#@COLOR@:@RRDPARAM@
  GPRINT:p at RRDIDX@:LAST: \: %5.1lf (cur)
  GPRINT:p at RRDIDX@:MAX: \: %5.1lf (max)
  GPRINT:p at RRDIDX@:MIN: \: %5.1lf (min)
  GPRINT:p at RRDIDX@:AVERAGE: \: %5.1lf (avg)\n

Should start seeing some fun stuff.
quoted from Martin Flemming

Regards
    Vernon


On Tue, Sep 21, 2010 at 5:26 PM, Martin Flemming <user-f286aaa49a76@xymon.invalid>wrote:
Dear all !

Perfectly .. it works like a charme .. :-)

.. one more question and how get them all in one graph ?

thanks a lot & cherrs,

       martin


On Tue, 21 Sep 2010, Vernon Everett wrote:

 Very elegant.
And something new for me. I have never used the "bbcmd bbhostshow"
command.
It's a much better way of getting the complete contents of all the
bb-hosts with includes.
Every day is a schoolday. :-)

I would suggest one or two improvements though.
egrep '^[1-9][0-9]*\.' doesn't cater for my Wintel hosts which are defined
with IP address 0.0.0.0
We let Xymon use DNS for them, so I dropped the first [1-9].

bb localhost "clientlog {} section=osversion" only works for Wintel.
I changed it to the following
bb localhost "clientlog {} section=osversion,uname"
This will grab the relevant info for Wintel as well as Solaris.

I then need to modify the output for Solaris, because the uname string
includes the hostname.
I eventually ended up with this.
./server/bin/bbcmd bbhostshow | egrep '^[0-9]*\.' \
                              | awk '{print $2}' \
                              | sort -u \
                              | xargs -I{} ./server/bin/bb localhost
"clientlog {} section=osversion,uname" \
                              | grep -v "^\[" \
                              | awk ' $1 == "SunOS" { print $1" "$3" "$4};
$1 != "SunOS" {print} ' \
                              | sort \
                              | uniq -c

That last awk might need to be seriously adapted for other OS types, or
perhaps pipe the output to another similar awk.
(Also, for SunOS, $4 is the patch level. Hack that to print $1" "$3 for OS
version only)

I ended up with output that looked like this
  10 Microsoft  (build 7600)
   2 Microsoft Windows Server 2003 R2, Standard Edition Service Pack 2
(build 3790)
   6 Microsoft Windows Server 2008 , 64-bit Service Pack 2 (build 6002)
   1 SunOS 5.10 Generic_139556-08
   4 SunOS 5.10 Generic_141444-09
  90 SunOS 5.10 Generic_142900-03
Useful?
I have no idea.

And yes, I agree, temp files are bad. But unfortunately, a necessary evil
sometimes.

Cheers
     Vernon


On Tue, Sep 21, 2010 at 3:07 PM, David Baldwin <
user-cbbf693f2c89@xymon.invalid> wrote:
     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
<user-b3f8dacb72c8@xymon.invalid <mailto:user-b3f8dacb72c8@xymon.invalid>> 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>;
    <
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
    <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>> 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
            <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>>
            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

            .. :-(
quoted from Martin Flemming

                 thanks & cheers,


                       Martin


            <mailto:xymon-unsubscribe at xymon.com>


        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
user-cbbf693f2c89@xymon.invalid          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.

list Martin Flemming · Thu, 23 Sep 2010 11:00:19 +0200 (CEST) ·

thanks a lot for all response !

.. test still working ... now i start  with the graphs :-)

cheers,
quoted from Vernon Everett
 	martin

On Tue, 21 Sep 2010, Vernon Everett wrote:
That's where the fun begins. :-)

Let's call your test name oscount (for lack of imagination on my part)

Send all your data to the server in the server using bb as if it was a normal test, but make sure your data is in the format
OS-Description-1 : xx
OS-Description-2 : yy
etc.etc

You then add oscount=ncv to TEST2RRD= in hobbitserver.cfg and add oscount to GRAPHS=
Same as we do for any new test. See examples on Xymonton

Then you also add in hobbitserver.cfg
SPLITNCV_oscount="*:GAUGE"

Remember to restart your server.

Creating graph definitions with SPLITNCV is easy.
Add this to hobbitgraph.cfg

[oscount]
  FNPATTERN oscount,(.*).rrd
  TITLE Number of instances of OS
  YAXIS Number
  -l 0
  DEF:p at RRDIDX@=@RRDFN@:lambda:AVERAGE
  LINE2:p at RRDIDX@#@COLOR@:@RRDPARAM@
  GPRINT:p at RRDIDX@:LAST: \: %5.1lf (cur)
  GPRINT:p at RRDIDX@:MAX: \: %5.1lf (max)
  GPRINT:p at RRDIDX@:MIN: \: %5.1lf (min)
  GPRINT:p at RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
Should start seeing some fun stuff.

Regards
    Vernon


On Tue, Sep 21, 2010 at 5:26 PM, Martin Flemming <user-f286aaa49a76@xymon.invalid> wrote:

      Dear all !

      Perfectly .. it works like a charme .. :-)

      .. one more question and how get them all in one graph ?

      thanks a lot & cherrs,

             martin


On Tue, 21 Sep 2010, Vernon Everett wrote:

      Very elegant.
      And something new for me. I have never used the "bbcmd bbhostshow" command.
      It's a much better way of getting the complete contents of all the bb-hosts with includes.
      Every day is a schoolday. :-)

      I would suggest one or two improvements though.
      egrep '^[1-9][0-9]*\.' doesn't cater for my Wintel hosts which are defined with IP address 0.0.0.0
      We let Xymon use DNS for them, so I dropped the first [1-9].

      bb localhost "clientlog {} section=osversion" only works for Wintel.
      I changed it to the following
      bb localhost "clientlog {} section=osversion,uname"
      This will grab the relevant info for Wintel as well as Solaris.

      I then need to modify the output for Solaris, because the uname string includes the hostname.
      I eventually ended up with this.
      ./server/bin/bbcmd bbhostshow | egrep '^[0-9]*\.' \
                                    | awk '{print $2}' \
                                    | sort -u \
                                    | xargs -I{} ./server/bin/bb localhost "clientlog {} section=osversion,uname"
      \
                                    | grep -v "^\[" \
                                    | awk ' $1 == "SunOS" { print $1" "$3" "$4}; $1 != "SunOS" {print} ' \
                                    | sort \
                                    | uniq -c

      That last awk might need to be seriously adapted for other OS types, or perhaps pipe the output to another
      similar awk.
      (Also, for SunOS, $4 is the patch level. Hack that to print $1" "$3 for OS version only)

      I ended up with output that looked like this
        10 Microsoft  (build 7600)
         2 Microsoft Windows Server 2003 R2, Standard Edition Service Pack 2 (build 3790)
         6 Microsoft Windows Server 2008 , 64-bit Service Pack 2 (build 6002)
         1 SunOS 5.10 Generic_139556-08
         4 SunOS 5.10 Generic_141444-09
        90 SunOS 5.10 Generic_142900-03
      Useful?
      I have no idea.

      And yes, I agree, temp files are bad. But unfortunately, a necessary evil sometimes.

      Cheers
           Vernon


      On Tue, Sep 21, 2010 at 3:07 PM, David Baldwin <user-cbbf693f2c89@xymon.invalid> wrote:
           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
<user-b3f8dacb72c8@xymon.invalid <mailto:user-b3f8dacb72c8@xymon.invalid>> 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
    <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>> 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
            <user-f286aaa49a76@xymon.invalid <mailto:user-f286aaa49a76@xymon.invalid>>
            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

            .. :-(
quoted from Vernon Everett

                 thanks & cheers,


                       Martin


            <mailto:xymon-unsubscribe at xymon.com>


        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
      user-cbbf693f2c89@xymon.invalid          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.