Managing HP Serviceguard for Linux, Tenth Edition, September 2012
F Monitoring Script for Generic Resources
The monitoring scripts are the scripts written by an end-user and must contain the core
logic to monitor a resource and set the status of a generic resource. These scripts are
started as a part of the package start.
• You can set the status/value of a simple/extended resource respectively using the
cmsetresource(1m) command.
• You can define the monitoring interval in the script.
• The monitoring scripts can be launched either within the Serviceguard environment
by configuring them as services, or outside of Serviceguard environment. It is
recommended to launch the monitoring scripts by configuring them as services.
See “Launching Monitoring Scripts” (page 341) for more information on launching
monitoring scripts.
Sample scripts
HP provides a monitoring script template and sample scripts to monitor a physical volume
that is part of HP-UX Logical volume group (LVM) and to monitor disk space of a file
system using extended generic resources. The template and sample scripts provided by
HP are:
• generic_resource_monitor.template
• sample_generic_resource_disk_monitor.sh
• sample_generic_resource_disk_space_monitor.sh
These are located in the /etc/cmcluster/examples directory.
See the template (page 343) to get an idea about how to write a monitoring script. Also,
see the sample scripts provided by HP at the location mentioned above.
How to monitor a resource is at the discretion of an end-user and the script logic must
be written accordingly. HP does not suggest the contents that goes into the monitoring
script. However, the following recommendations might be useful:
• Choose the monitoring interval based on how quick the failures must be detected
by the application packages configured with a generic resource.
• Get the status/value of a resource using cmgetresource before setting the
status/value of a generic resource.
• Set the status/value only if it has changed.
See “Getting and Setting the Status/Value of a Simple/Extended Generic Resource”
(page 128) and the cmgetresource(1m) and cmsetresource(1m) manpages.
See “Using the Generic Resources Monitoring Service” (page 55)
340 Monitoring Script for Generic Resources