Managing HP Serviceguard for Linux, Tenth Edition, September 2012

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
Template of a Monitoring Script 345