[hobbit] multiple hosts

Scheblein, Adam adam.scheblein at marquette.edu
Wed Jan 11 17:15:02 CET 2006


I know for us here (running trucluster 5) we ran into the same problem, here is my modified runclient.sh script (the changes are basically I added the `hostname` part to the lock files:

#!/bin/sh
#----------------------------------------------------------------------------#
# Hobbit client bootup script.                                               #
#                                                                            #
# This invokes hobbitlaunch, which in turn runs the Hobbit client and any    #
# extensions configured.                                                     #
#                                                                            #
# Copyright (C) 2005 Henrik Storner <henrik at hswn.dk>                         #
#                                                                            #
# This program is released under the GNU General Public License (GPL),       #
# version 2. See the file "COPYING" for details.                             #
#                                                                            #
#----------------------------------------------------------------------------#
#
# $Id: runclient.sh,v 1.6 2005/09/28 21:21:17 henrik Exp $

# Default settings for this client
MACHINEDOTS="`uname -n`"                        # This systems hostname
BBOSTYPE="`uname -s | tr '[A-Z]' '[a-z]'`"      # This systems operating system in lowercase
BBOSSCRIPT="hobbitclient-$BBOSTYPE.sh"

# Commandline mods for the defaults
while test "$1" != ""
do
        case "$1" in
          --hostname=*)
                MACHINEDOTS="`echo $1 | sed -e's/--hostname=//'`"
                ;;
          --os=*)
                BBOSTYPE="`echo $1 | sed -e's/--os=//' | tr '[A-Z]' '[a-z]'`"
                ;;
          --help)
                echo "Usage: $0 [--hostname=CLIENTNAME] [--os=rhel3|linux22] start|stop"
                exit 0
                ;;
          start)
                CMD=$1
                ;;
          stop)
                CMD=$1
                ;;
          restart)
                CMD=$1
                ;;
        esac

        shift
done

OLDDIR="`pwd`"
cd "`dirname $0`"
HOBBITCLIENTHOME="`pwd`"
cd "$OLDDIR"

MACHINE="`echo $MACHINEDOTS | sed -e's/\./,/g'`"

export MACHINE MACHINEDOTS BBOSTYPE BBOSSCRIPT HOBBITCLIENTHOME

case "$CMD" in
  "start")
        if test ! -w $HOBBITCLIENTHOME/logs; then
                echo "Cannot write to the $HOBBITCLIENTHOME/logs directory"
                exit 1
        fi
        if test ! -w $HOBBITCLIENTHOME/tmp; then
                echo "Cannot write to the $HOBBITCLIENTHOME/tmp directory"
                exit 1
        fi

        if test -f $HOBBITCLIENTHOME/logs/clientlaunch.`hostname`.pid; then
                echo "Hobbit client already running, re-starting it"
                $0 stop
                rm -f $HOBBITCLIENTHOME/logs/clientlaunch.`hostname`.pid
        fi

        $HOBBITCLIENTHOME/bin/hobbitlaunch --config=$HOBBITCLIENTHOME/etc/clientlaunch.cfg --log=$HOBBITCLIENTHOME/logs/clientlaunch.log --pidfile=$HOBBITCLIENTHOME/logs/clientlaunch.`hostname`.pid
        if test $? -eq 0; then
                echo "Hobbit client for $BBOSTYPE started on $MACHINEDOTS"
        else
                echo "Hobbit client startup failed"
        fi
        ;;

  "stop")
        if test -f $HOBBITCLIENTHOME/logs/clientlaunch.`hostname`.pid; then
                kill `cat $HOBBITCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid`
                echo "Hobbit client stopped"
        else
                echo "Hobbit client not running"
        fi
        ;;

  "restart")
        if test -f $HOBBITCLIENTHOME/logs/clientlaunch.`hostname`.pid; then
                $0 stop
        else
                echo "Hobbit client not running, continuing to start it"
        fi

        $0 start
        ;;
esac

exit 0


-----Original Message-----
From: David Gore [mailto:David.Gore at mci.com] 
Sent: Wednesday, January 11, 2006 9:52 AM
To: hobbit at hswn.dk
Subject: Re: [hobbit] multiple hosts

Rolf,

I asked a similar question many months ago for our Digital UNIX (4.x) 
boxes running in multiple clusters.  I did not get any answer, so I had 
to create a hack that does run multiple clients on each host.  One 
client is for the physical host and does, cpu, disk, etc, and one client 
for the logical/virtual host that does the tasks specific to the 
logical/virtual host.  The runclient.sh script runs every ten minutes 
via crontab, to make sure both clients are running and starts either 
client if they are not.  I also have custom versions of some of the 
default Hobbit client scripts to support multiple clients on a single 
host.  So in short as far as I know, you are going to have to 
hack/script your own solution.  I don't mind sending you what my hobbit 
scripts have turned into, but it may not be what you are looking for.

David Gore 

*e-mail via SUSE Linux 9.3 and other open source tools. 



Rolf Schrittenlocher wrote:
> Hi,
>
> as there was no answer to my first mail, I try again with other words:
>
> Our machines may have one or more aliases (virtual hosts) which all 
> have DNS-entries. Normally we refer to the machines not using the 
> hostname but by the alias, each of them combined to a bundle of 
> functions and tasks. So a machine "frodo.xxx.de" might host 
> "webserver.xxx.de", "dnsserver.xxx.de" and "tolkserver.xxx.de".  These 
> aliases and of course the tasks related to them are transferred to 
> another machine in case of hardware failure, maintenance, etc.
> In bb-hosts we have an entry for each machine (to get data from this 
> machine in case there is no alias set on it) and of course for all 
> relevant aliases. What we need now is that the general client data 
> (cpu, disk, ssh, ...) for each machine appears both with the hostname 
> and all aliases set on it.
> I added a script to runclient.sh which creates 
> ~/client/etc/clientlaunch.cfg dynamically according to the aliases set 
> on the machine before starting the client. This assures that the 
> correct data is polled on the client. I may modify $MACHINE or Í may 
> use the CLIENT:hostname tag in bb-hosts to make the client send 
> messages with a different name. But that would require several 
> instances of the client running, somethin I dislike. I hope there is a 
> way to send the client data once and to make the server look at some 
> configuration file to see where he should  present these data. Maybe 
> that possibility exists but I haven't found it yet. So I hope that 
> someone could indicate me where to search for the places which I have 
> to "hack" hoping that it is possible to do that with shell or perl as 
> my C-knowledge isn't so good. But even if C is necessary: Any hints 
> are appreciated.
>
> Thanks Rolf
>


To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk





More information about the Xymon mailing list