HP Serviceguard A.11.20- Managing Serviceguard Twentieth Edition, August 2011
K 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 390) 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 392) 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 135)
and the cmgetresource(1m) and cmsetresource(1m) manpages.
See “Using the Generic Resources Monitoring Service” (page 57)
Launching Monitoring Scripts
Monitoring scripts can be launched in the following ways:
For resources of evaluation_type: during_package_start
• Monitoring scripts can be launched through the services functionality that is available in
packages, as indicated by service_name, service_cmd, and service_halt_timeout.
This makes the monitoring scripts highly available, since Serviceguard monitors them and is
the recommended approach.
• Monitoring scripts can also be launched through external_script or external_pre_script as part
of the package.
• Monitoring scripts can also be launched outside of the Serviceguard environment, init, rc
scripts, etc. (Serviceguard does not monitor them)
390 Monitoring Script for Generic Resources