[hobbit] Server-side extension scripts: shell vs. C programming

Gary Baluha gumby3203 at gmail.com
Fri Jun 29 15:42:50 CEST 2007


> On Thu, Jun 28, 2007 at 02:12:33PM -0400, Gary Baluha wrote:
> > I remember reading somewhere in the Hobbit documentation that when an
> > extension script starts to do a lot of things, it should be coded in a
> > compiled language such as C, instead of as a shell script.  I have a
> custom
> > script that takes a lot of data and converts it into NCV graphs, and I
> > believe it is at the point where I should consider rewriting it in C.
>
> It really depends on how much work it does, and how often it runs: Do
> you have 10 hosts calling into Hobbit with this kind of data, or 1000 ?
> Your system load will be much less with a compiled C program than with
> a shellscript or Perl program, but it should be considered against the
> amount of work needed to re-implement your script.


I actually wasn't expecting to get this much [helpful] feedback, so maybe I
should explain a little more what my script is currently doing.

I have about 20 or 30 html monitors (which are going after various
non-port-80 pages).  These web pages are output from a weblogic program
which reports various statistics about the managed servers' health.  My
script takes this data and creates several RRD trend graphs.  There are
about 10 graphs per web page, and each graph has anywhere from 3-15 data
points.  The main reason I'm rewriting it from shell script is that the
current code is starting to get difficult to add new data points to, and
since I have to clean it up anyway, I'd like to take advantage of some of
the features perl or C have.

> Before I get to far into it, is the hobbitd_sample.c something that I
> should
> > look at for this?  I'm not sure if I'm reading the documentation on it
> > correctly, if it is a good example for an external script.
>
> hobbitd_sample shows how your program is fed data from Hobbit. I'm
> not sure quite how your program currently works - does it run via
> the "--extra-script" option to hobbitd_rrd ? In that case it might
> be easier for you to just convert your current script into a C program
> and still run it via the extra-script option.


I'm running the script from the hobbitlaunch.cfg config file.

If you do decide that the extra-script method is too heavy, then
> modifying the hobbitd_rrd module is the easiest way to go. You'll have
> to create a new routine to parse the data - start with a simple one
> like hobbitd/rrd/do_bbtest.c, which just finds a single value in the
> "bbtest" status message, and updates and RRD file with it. Then you
> must add two lines to hobbitd/do_rrd.c: An "#include rrd/myfile.c" to
> pick up the parser routine you just wrote, and a line near the bottom
> of the file where you invoke your parser whenever the correct "status"
> or "data" message arrives.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20070629/b3ff8ea8/attachment.html>


More information about the Xymon mailing list