[hobbit] Hobbit client reporting question

Henrik Stoerner henrik at hswn.dk
Thu Sep 29 22:06:55 CEST 2005


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




More information about the Xymon mailing list