Xymon Mailing List Archive search

Configuration database backend.

list Henrik Størner
Fri, 8 Dec 2006 21:45:40 +0100
Message-Id: <user-69f6c0c1519b@xymon.invalid>

On Fri, Dec 08, 2006 at 04:32:59PM +0100, Stef Coene wrote:
On Friday 08 December 2006 14:05, Henrik Stoerner wrote:
Be careful with the status messages, at least if you want to store the
current status in a DB. Historical status messages - those that are
currently stored in the histlogs/ directory - are OK, but for the
current status log I think that the overhead associated with updating
each status log in a DB every 5 minutes will be very high. And the
number of times you'll actually be retrieving these data will probably
be very small.
Today I could have used such information.  One of our servers went down, out 
of memory status.  No way to know the process that did this.
If it was running a Hobbit client, it should have saved the latest
client message before it crashed, including the "ps" listing.
Copying the historical statuslogs (or the current ones) is very easy to
do with an extra Hobbit worker module hanging off the "status" or
"stachg" channels. You do not need to make any modifications to Hobbit
itself - you basically run "hobbitd_channel --channel=stachg MYDBPROGRAM"
and your program is fed all of the status messages on it's STDIN.
Is there any information about the channels?  I know there is also a notes 
channel, but I couldn't find any (usefull) information how to use this.  Same 
for the data channel.  I want to "misuse" the hobbit communication to send 
extra information.
It's a plain-text protocol. The easiest way to look at it is to run

   hobbitd_channel --channel=status cat

and just watch the messages go by. Each message begins with a line

   @@status#1234|TIMESTAMP|HOSTNAME|

and some more fields on the first line; then comes the text (if any)
for the message - for a status message, this will be the raw message
text. Finally, a line with "@@" marks the end of the message. It's
pretty simple to work out the fields, except for the timestamps -
there are timestamps for the time the message was received, the time of
the last status change, the expiry time for ack's and disables etc.
But for just storing it into a DB you probably don't need to care much
about those. If you do, look at hobbitd/hobbitd.c and the
posttochannel() routine which builds these messages.


Regards,
Henrik