[hobbit] Hobbit client reporting question
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
-----Original Message----- From: Henrik Stoerner [mailto:henrik at hswn.dk] Sent: Thursday, September 29, 2005 1:01 PM To: hobbit at hswn.dk 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
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
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
participants (2)
-
adam.scheblein@marquette.edu
-
henrik@hswn.dk