[hobbit] Solaris 10 SMF monitor

Ward, Martin Martin.Ward at colt.net
Wed Feb 20 13:51:15 CET 2008


> It takes a while for the client-local.cfg settings to 
> percolate over to the client itself (a: hobbitd has to reload 
> the file, b: the client has to contact the Hobbit server and 
> pickup the setting, c: it won't take effect until the next 
> run of the client) - up to 15 minutes.

I restarted both server and client processes then waited until the
logfetch file was updated but nothing was being changed in the file.

> And of course - it assumes you're running the clients with 
> server-side configuration. Some still prefer to keep 
> configuration settings on the clients.

I checked that too and we are not running in --local mode.

However, your suggestions did point me in a new direction which resolved
to the fact that this client is being managed by two Hobbit servers and
my one was second in the client's hobbitclient.cfg file. The client was
taking its config from the first.

A swift update to the client config file and I can now see the changes I
made on the server reflected in the file on the client, so I have now
modified my bb-smf.sh script as you suggested. Attached is v1.1.

Thanks for the assistance!

----
# A Hobbit script to examine specific Solaris 10 services.

# Author: Martin Ward 19 Feb 2008.
# Version: 1.0 - Initial version.
# V1.1  Script now takes the list of services to monitor from the server
#       via the logfetch file.

# SVCS is a list of services to examine the status of. Each name must be
# specific enough to make it unique in the output from the 'svcs -a'
command.
# Separate each service with a | so that we can use ${EGREP} to search
for them.
# The services themselves are configured on the Hobbit server in the
# ~hobbit/server/etc/client-local.cfg file. The line will look something
like:
# svc:/network/ssh:default|svc:/site/tftpd:default

SVCS=`grep '^svc:' $BBTMP/logfetch.$MACHINEDOTS.cfg`

# The name of the column in Hobbit
COLUMN=smf

# COLOUR defaults to green
COLOUR=GREEN

# When you modify a variable inside a while loop its value is local to
that
# loop. This means that when you reach the end of the loop the variable
will
# be the same value that it was before the loop was entered. For this
reason
# we have to store the services and colour in temporary files.
SVCFILE=/tmp/svcs.$$
COLOURFILE=/tmp/svcs.colour.$$

# Get the svcs header line first
MSGH=`svcs -a | head -1`

# Scan through the svcs -a list. Use -a to ensure we get everything.
svcs -a | ${EGREP} "${SVCS}" > $SVCFILE

cat $SVCFILE | while read SVC
do
        STATE=`echo ${SVC} | ${AWK} '{print $1}'`

        case "${STATE}" in
'uninitialized'|'offline'|'degraded')
                if [ "${COLOUR}" != "RED" ]
                then
                        COLOUR="YELLOW"
                fi
                ;;
'maintenance'|'disabled')
                COLOUR="RED"
                ;;
        esac
        echo ${COLOUR} > $COLOURFILE
done

COLOUR=`cat ${COLOURFILE}`

# Tell Hobbit about it
$BB $BBDISP "status $MACHINE.$COLUMN $COLOUR `date`

${MSGH}
`cat ${SVCFILE}`
"

rm -f ${SVCFILE} ${COLOURFILE}

exit 0
----
|\/|artin


*************************************************************************************
The message is intended for the named addressee only and may not be disclosed to or used by anyone else, nor may it be copied in any way. 

The contents of this message and its attachments are confidential and may also be subject to legal privilege.  If you are not the named addressee and/or have received this message in error, please advise us by e-mailing security at colt.net and delete the message and any attachments without retaining any copies. 

Internet communications are not secure and COLT does not accept responsibility for this message, its contents nor responsibility for any viruses. 

No contracts can be created or varied on behalf of COLT Telecommunications, its subsidiaries or affiliates ("COLT") and any other party by email Communications unless expressly agreed in writing with such other party.  

Please note that incoming emails will be automatically scanned to eliminate potential viruses and unsolicited promotional emails. For more information refer to www.colt.net or contact us on +44(0)20 7390 3900.




More information about the Xymon mailing list