[hobbit] Adding a new tag

Henrik Stoerner henrik at hswn.dk
Wed Aug 10 07:47:36 CEST 2005

On Wed, Aug 10, 2005 at 11:26:41AM +0700, Zakki Ashshidiqi wrote:
> I call dns,smtp,pop3,noconn,noping as a tag.
> So, is there any 'how-to' to add my own tag? Let say, my tag is
> 'roaming'.
> In the bb-host will be like this (for the host I want to do a 'roaming'
> test):
> www.yyy.xxx	# roaming
> I already made the script, but I don't know how hobbitd will call my
> script.
> Should I just put it as an ext script?

The short answer:

If your script does all the work of generating a status message
and sending it to Hobbit using the "bb" commandline tool, then
you can just run it as an external script.

The long answer:

You don't say if your script is one that runs on each of your
clients and reports a status for only that client, or if it's
something that runs on a central server and generates a status
for several hosts. That can make a difference:

- client-side scripts generally don't need any kind of tags
  in the bb-hosts file; you just run them on the client, and
  they generate a status message. Hobbit picks up whatever
  status messages arrive, and puts them on the web display.

- server scripts may need a tag in the bb-hosts file, if they
  have been written to look for one. It is fairly common to 
  have server-side scripts that perform some custom test on
  a series of hosts, and you can use a tag in the bb-hosts file
  to tell your script which hosts it should test. But you
  don't have to; it depends on how you want to implement 
  your script.
  If you want to use a tag in the bb-hosts file, your script
  should do something like this.


  # Name of the column we generate

  # The tag we look for in the bb-hosts file

  bbhostgrep --no-extras $BBHOSTSTAG |
  while read L; do
    set $L
    MACHINE=`echo $HOSTNAME | sed -e's/\./,/g'`

    # do your test against the host with IP $HOSTIP
    COLOR=...    # The color you decide 
    MSG=...      # The message text you pass back

    $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`


  The "bbhostgrep" picks out those lines in the bb-hosts file that has
  your tag in them, and you can then get the IP-address and hostname
  for each of them. Using this tool is the best way, because it does
  all of the tricky parsing of the bb-hosts file for you - and it works
  if you start using include-files into the bb-hosts file, or your
  admin begins splitting up entries onto multiple lines etc.


More information about the Xymon mailing list