Solaris 10 SMF service monitor

Author wardmw
Compatibility Xymon 4.2
Requirements Solaris 10
Download None
Last Update 2010-07-29

A small script that sits on the Solaris 10 clients and is executed from the clientlaunch.cfg configuration. Services to be monitored are configured on the Xymon server and passed to the client. This script then checks the status of the individual services are returns the following: Green for 'online' services. Yellow for 'uninitialized', 'offline' or 'degraded' services. Red for 'maintenance' or 'disabled' services.

Client side

1. Copy the script into the client/ext/ sub-directory of every client that you want to monitor.

2. Edit the client/etc/clientlaunch.cfg of every client from step 1 and insert the following text:

# Service Monitoring
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
        LOGFILE $HOBBITCLIENTHOME/logs/smf.log
        INTERVAL 5m

Server side

3. Edit the server/etc/client-local.cfg file and insert a line similar to this for each client or section:


All services for a specific server or group must be specified on a single line, separated with a pipe symbol. In the example above we are monitoring three different services, ssh, tftpd and Apache.

Show Code ⇲

Hide Code ⇱

# 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

# Verify existence of the config file
if [ ! -f $BBTMP/logfetch.$MACHINEDOTS.cfg ]
        echo "Unable to retrieve services descriptions."
        exit 1

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

# The name of the column in Hobbit

# COLOUR defaults to 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.

# Set up the initial 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
        STATE=`echo ${SVC} | ${AWK} '{print $1}'`

        case "${STATE}" in
                if [ "${COLOUR}" != "RED" ]
        echo ${COLOUR} > $COLOURFILE


# Tell Hobbit about it

`cat ${SVCFILE}`


exit 0

None so far.

  • 2010-07-29
    • Initial public release
  • monitors/
  • Last modified: 2010/07/29 10:51
  • by