Managing Serviceguard A.11.20, March 2013
#
#
#########################################################################
function stop_command
{
sg_log 5 "stop_command"
# ADD your halt steps here
exit 1
}
################
# main routine
################
sg_log 5 "customer defined monitor script"
#########################################################################
#
# Customer defined monitor script should be doing following
# functionality.
#
# When the package is halting, cmhaltpkg will issue a SIGTERM signal to
# the service(s) configured in package. Use SIGTERM handler to stop
# the monitor script.
#
# Monitor the generic resource configured in package using customer
# defined tools and set the status or value to generic resource by using
# "cmsetresource" command. When setting the status or value get the current
# status or value using "cmgetresource" and set only if they are different.
#
#########################################################################
start_command $*
# SIGTERM signal handler to stop the monitor script
trap "stop_command" $SIGTERM
while [ 1 ]
do
# Using customer defined tools get the status or value
# of generic resource(s) which are configured in package.
# Set the status or value of the generic resource using
# "cmsetresource" command. Before setting the stauts or value
# compare the new status or value by getting the existing status or
# value using "cmgetresource" and set only if they are different.
# Wait for customer defined interval to check the status or value
# for next time.
done
Sample script to monitor a physical volume that is a part of HP-UX Logical volume group (LVM)
using the SFM monitoring mechanism can be found at: .
/etc/cmcluster/examples/sample_generic_resource_disk_monitor.sh
Before using this script, copy it to the package specific directory. This script expects the following
parameters when configured as a service:
• $1 : Generic resource name: The name of the generic resource configured in the package
that corresponds to this monitoring script.
• $2 : LVM volume group name: The name of the LVM logical volume group whose physical
disks need to be monitored.
• $3 : Monitor interval: The time interval between successive monitors.
400 Monitoring Script for Generic Resources