Xymon Mailing List Archive search

Hobbit client reporting question

6 messages in this thread

list Adam Scheblein · Thu, 29 Sep 2005 12:22:24 -0500 ·
Greetings,

I saw that the hobbit client reports back "who" information, and I was
wondering what would have to be done to make it so that I could
implement that reporting functionality server side.  Even if it is not
coded yet, just point me in the right direction and I will come up with
something (this way I don't feel like a slacker and actually contribute
back to hobbit)

Thanks,
Adam Scheblein
Marquette University
UNIX Systems Administrator
list Henrik Størner · Thu, 29 Sep 2005 20:00:55 +0200 ·
quoted from Adam Scheblein
On Thu, Sep 29, 2005 at 12:22:24PM -0500, Scheblein, Adam wrote:
I saw that the hobbit client reports back "who" information, and I was
wondering what would have to be done to make it so that I could
implement that reporting functionality server side. 
Well, what would you like to do with it ?

Right now, the "who" output is used only to count the number of
logged-on users, which is then fed into the "users" RRD (available
in the "trends" column).

I haven't really thought much about what to do with the client data
apart from feeding it into the cpu/disk/memory/... status columns. 
But the data is there, and can be used for whatever purpose you'd
like.
quoted from Adam Scheblein
Even if it is not
coded yet, just point me in the right direction and I will come up with
something (this way I don't feel like a slacker and actually contribute
back to hobbit)
The simplest way of getting the client data is through the "bb" tool:

   bb 127.0.0.1 "clientlog localhost"

dumps the entire client message from the host "localhost" to stdout.
This is split into sections, like

   [uptime]
     19:59:52 up 4 days, 12:28,  2 users,  load average: 0.44, 0.22, 0.07
   [df]
    Filsystem            1K-blokke     Brugt   Tilbage Brug% Monteret på
    /dev/hda2             99511580   3604200  95907380   4% /
    /dev/hda3             47856164  37241288  10614876  78% /work

If you only want the "who" section, then you can use

   bb 127.0.0.1 "clientlog localhost section=who"


If you need more info, let me know.


Regards,
Henrik
list Adam Scheblein · Thu, 29 Sep 2005 13:14:25 -0500 ·
Basically I want to fold in bb-who into hobbit where you can say if root is logged in then panic, if foo is logged in then warn, and then display that on the main page as well as just a general "who".  We wouldn't really need any graphing, just a server tweak -- but if I wanted it to happen at the same frequency as all the other tests where would it be put?

Thanks,
Adam
quoted from Henrik Størner

-----Original Message-----
From: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid] 
Sent: Thursday, September 29, 2005 1:01 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Hobbit client reporting question

On Thu, Sep 29, 2005 at 12:22:24PM -0500, Scheblein, Adam wrote:
I saw that the hobbit client reports back "who" information, and I was
wondering what would have to be done to make it so that I could
implement that reporting functionality server side. 
Well, what would you like to do with it ?

Right now, the "who" output is used only to count the number of
logged-on users, which is then fed into the "users" RRD (available
in the "trends" column).

I haven't really thought much about what to do with the client data
apart from feeding it into the cpu/disk/memory/... status columns. 
But the data is there, and can be used for whatever purpose you'd
like.
Even if it is not
coded yet, just point me in the right direction and I will come up with
something (this way I don't feel like a slacker and actually contribute
back to hobbit)
The simplest way of getting the client data is through the "bb" tool:

   bb 127.0.0.1 "clientlog localhost"

dumps the entire client message from the host "localhost" to stdout.
This is split into sections, like

   [uptime]
     19:59:52 up 4 days, 12:28,  2 users,  load average: 0.44, 0.22, 0.07
   [df]
    Filsystem            1K-blokke     Brugt   Tilbage Brug% Monteret på
    /dev/hda2             99511580   3604200  95907380   4% /
    /dev/hda3             47856164  37241288  10614876  78% /work

If you only want the "who" section, then you can use

   bb 127.0.0.1 "clientlog localhost section=who"


If you need more info, let me know.


Regards,
Henrik
list Henrik Størner · Thu, 29 Sep 2005 22:06:55 +0200 ·
quoted from Adam Scheblein
On Thu, Sep 29, 2005 at 01:14:25PM -0500, Scheblein, Adam wrote:
Basically I want to fold in bb-who into hobbit where you can 
say if root is logged in then panic, if foo is logged in then 
warn, and then display that on the main page as well as just 
a general "who".  We wouldn't really need any graphing, just 
a server tweak -- but if I wanted it to happen at the same 
frequency as all the other tests where would it be put?
OK - I've never used that extension, so I hadn't thought about
using those data like that.

I had a look at bb-who, and it seems to generate a separate
status column "who" with the output from "who". The color of
this status then varies, depending on who is logged in.

The way I would implement this for Hobbit would be as a 
server module that is fed the client data and acts on it.

Try logging in as the hobbit user on your Hobbit server,
then run "bbcmd hobbitd_channel --channel=client cat".
Whenever a client sends in an update message about itself,
you'll have it dumped to stdout (actually, it is read by the
"cat" utility, which then dumps it to stdout). It looks like this:

hobbit at osiris:~$ bbcmd hobbitd_channel --channel=client cat
@@client#1201|1128023857.793392|172.16.10.2|osiris.hswn.dk|linux
client osiris,hswn,dk.linux
[date]
Thu Sep 29 21:57:26 CEST 2005
[uname]
Linux osiris.hswn.dk 2.6.7 #2 Wed Jun 16 22:25:25 CEST 2004 i686
GNU/Linux
[uptime]
 21:57:26 up 247 days, 23:10,  0 users,  load average: 0.00, 0.14, 0.21
[who]
henrik   :0           Sep 25 07:54
henrik   :0           Sep 25 07:54
... lots more lines ...
@@

So the client messages go from the "@@client..." line until the
"@@" line, and inside that is the section beginning with "[who]".

What you need to do is write a program that receives these messages,
picks out the hostname from the fourth field in the "@@client..."
line, and then grabs the data from the "[who]" section of the client
message. You can then use these to build a status message, and send
it off to Hobbit as a new status column. For debugging you can run it
by hand; when it works, you just add a new section in hobbitlaunch.cfg
for this new module.

I don't know what your favourite programming language is - IF you want
to implement this as a C program, there's a skeleton module included
with Hobbit in the hobbitd/hobbitd_sample.c file, which has all of the
necessary stuff to pick up a message, split up the "@@client..." line
into fields, and generally lets you concentrate on what you want to
do with the data.

If you'd rather implement this in Perl, Python or some other language -
fine, then you'll just have to write that bit of code to fetch a single
message from stdin and process it.


Regards,
Henrik
list Adam Scheblein · Mon, 03 Oct 2005 14:44:45 -0500 ·
Henrik,

I have a working prototype, and have tested it against tru64 and hpux 
and linux.  Unfortunately my c programming skills are not up to snuff, 
so i currently have it done as a shell script.  Where do you want me to 
send it -- to the list?  and also, would you prefer me to do it in C 
rather than shell?

thanks,
Adam
quoted from Henrik Størner

Henrik Stoerner wrote:
On Thu, Sep 29, 2005 at 01:14:25PM -0500, Scheblein, Adam wrote:
 
Basically I want to fold in bb-who into hobbit where you can 
say if root is logged in then panic, if foo is logged in then 
warn, and then display that on the main page as well as just 
a general "who".  We wouldn't really need any graphing, just 
a server tweak -- but if I wanted it to happen at the same 
frequency as all the other tests where would it be put?
   
OK - I've never used that extension, so I hadn't thought about
using those data like that.

I had a look at bb-who, and it seems to generate a separate
status column "who" with the output from "who". The color of
this status then varies, depending on who is logged in.

The way I would implement this for Hobbit would be as a 
server module that is fed the client data and acts on it.

Try logging in as the hobbit user on your Hobbit server,
then run "bbcmd hobbitd_channel --channel=client cat".
Whenever a client sends in an update message about itself,
you'll have it dumped to stdout (actually, it is read by the
"cat" utility, which then dumps it to stdout). It looks like this:

hobbit at osiris:~$ bbcmd hobbitd_channel --channel=client cat
@@client#1201|1128023857.793392|172.16.10.2|osiris.hswn.dk|linux
client osiris,hswn,dk.linux
[date]
Thu Sep 29 21:57:26 CEST 2005
[uname]
Linux osiris.hswn.dk 2.6.7 #2 Wed Jun 16 22:25:25 CEST 2004 i686
GNU/Linux
[uptime]
21:57:26 up 247 days, 23:10,  0 users,  load average: 0.00, 0.14, 0.21
[who]
henrik   :0           Sep 25 07:54
henrik   :0           Sep 25 07:54
... lots more lines ...
@@

So the client messages go from the "@@client..." line until the
"@@" line, and inside that is the section beginning with "[who]".

What you need to do is write a program that receives these messages,
picks out the hostname from the fourth field in the "@@client..."
line, and then grabs the data from the "[who]" section of the client
message. You can then use these to build a status message, and send
it off to Hobbit as a new status column. For debugging you can run it
by hand; when it works, you just add a new section in hobbitlaunch.cfg
for this new module.

I don't know what your favourite programming language is - IF you want
to implement this as a C program, there's a skeleton module included
with Hobbit in the hobbitd/hobbitd_sample.c file, which has all of the
necessary stuff to pick up a message, split up the "@@client..." line
into fields, and generally lets you concentrate on what you want to
do with the data.

If you'd rather implement this in Perl, Python or some other language -
fine, then you'll just have to write that bit of code to fetch a single
message from stdin and process it.


Regards,
Henrik

list Henrik Størner · Mon, 3 Oct 2005 23:01:55 +0200 ·
Hi Adam,
quoted from Adam Scheblein

On Mon, Oct 03, 2005 at 02:44:45PM -0500, Adam Scheblein wrote:
Henrik,

I have a working prototype, and have tested it against tru64 and hpux and linux.  Unfortunately my c programming skills are not up to snuff, so i currently have it done as a shell script.  Where do you want me to send it -- to the list?  and also, would you prefer me to do it in C rather than shell?
Send it to me directly, I'll look it over and put it up for download
somewhere on the sourceforge pages.

The only reason for moving to C instead of a shell script would be
performance; or if it should become standard part of Hobbit. I certainly don't mind having it as a shell script; it can also serve
as a demonstration that Hobbit does have the flexibility that lets
you do add-on modules with simple scripting languages.


Regards,
Henrik