Managing HP Serviceguard A.11.20.10 for Linux, December 2012

G Monitoring Script for Generic Resources
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 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.
For more information, see “Launching Monitoring Scripts” (page 289).
Template Scripts
HP provides a monitoring script template. The template provided by HP is:
generic_resource_monitor.template
This is located in the /usr/local/cmcluster/conf/examples/ directory.
See the template (page 291) to get an idea about how to write a monitoring script.
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 content 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 generic resource using cmgetresource before setting its
status/value.
Set the status/value only if it has changed.
See “Getting and Setting the Status/Value of a Simple/Extended Generic Resource” (page 106)
and the cmgetresource(1m) and cmsetresource(1m) manpages.
See “Using the Generic Resources Monitoring Service” (page 50).
G.1 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 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)
It is not mandatory to have the same name for a generic resource and its monitoring script,
i.e., service_name and generic_resource_name. However, it is good practice to have
the same name, so that it is easier to identify the monitor.
A common resource specified across multiple packages can be monitored using one monitoring
script.
G.1 Launching Monitoring Scripts 289