[hobbit] database backend

Henrik Stoerner henrik at hswn.dk
Mon Feb 28 22:43:20 CET 2005


On Mon, Feb 28, 2005 at 12:46:44PM -0800, Brian Lynch wrote:
> Any thoughts to a mysql or other database backend for reporting
> purposes?  There was a brief hack on the bb source code, but no action
> from Sean.

I haven't done it, but it will be very, very easy to implement. For
reporting you just want to know what status changes have occurred, so
you simply need to come up with a Hobbit "worker module" that receives
messages from the Hobbit "stachg" channel, and stores them in your
database.

Worker modules can be written in whatever language you fancy, although
I'd advise against shell-scripts for performance reasons. Perl,
Python, C, C++, Java ... pick your favourite programming tool.

All the module needs to do is read the messages off it's standard
input filehandle, and store them in the database. Each message is
formatted like this:

  @@stachg|timestamp|sender|origin|hostname|testname|expiretime|color|prevcolor|changetime
  <new status message>
  @@

So it is very easy to pick out the first line and grab all of the
information you will normally need from that.

There's a sample module provided with the Hobbit sources, see the
"hobbit-4.0-RC4/hobbitd/hobbitd_sample.c" file which illustrates how
to build a worker module in C.


Henrik



More information about the Xymon mailing list