[Beowulf] tools for cluster event logging?

David Mathog mathog at caltech.edu
Tue Nov 25 14:20:34 PST 2008


Here is a little init.d script "cluster_notify" I put together that
uses syslog to log init state changes that take place on the computer
nodes on the master node. For instance here is what comes out when one
node is rebooted:


Nov 25 13:23:21 monkey01.cluster logger: init change: 3 6 
Nov 25 13:24:43 monkey01.cluster logger: init change: N 3 

The script is for a Mandriva system, so it would probably work
unchanged on RedHat or Fedora.  For Debian changes are probably needed.

cat cluster_notify
#!/bin/sh

# chkconfig: 2345 11 89
# description: This startup script tells the cluster about init changes

### BEGIN INIT INFO
# Provides: cluster_notify
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2345
# Short-Description: Inform cluster log of init state on client
# Description: Inform cluster log of init state on client
### END INIT INFO


# Local variables
LFILE=/var/lock/subsys/cluster_notify

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

doit(){
        gprintf "Cluster_Notify, new init level"
        transition=`/sbin/runlevel`
        /bin/logger -p news.info "init change: $transition"
        echo 
}

RETVAL=0
case "$1" in
    start)
        touch $LFILE
        doit
        ;;
    stop)
        rm -f $LFILE
        doit
        ;;
    *)
        gprintf "Usage: %s {start,stop}\n" "$0"
        RETVAL=1
        ;;
esac

exit $RETVAL



Regards,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech



More information about the Beowulf mailing list