Managing HP Serviceguard for Linux, Tenth Edition, September 2012

service_name lan1_monitor
service_cmd $SGCONF/generic_resource_monitors/lan1.sh
service_name cpu_monitor
service_cmd $SGCONF/generic_resource_monitors/cpu_monitor.sh
The above example shows a sample multi-node package named
generic_resource_monitors and has two monitoring scripts configured — one
each to monitor a LAN and CPU. These monitoring scripts will monitor the LAN interface,
CPU and sets the status of the generic resources defined in them accordingly.
Consider a package pkg1 having the LAN resource configured as
before_package_start and the monitoring script for this is running in the multi-node
package generic_resource_monitors. A dependency is created such that the
multi-node package must be UP in order to start the package pkg1. Once the multi-node
package is started, the monitoring of resource 'lan1' gets started as part of the monitoring
script 'lan1.sh'. The script will set the status of the generic resource 'lan1' and once the
is UP, the package pkg1 is eligible to be started.
package_name pkg1
package_type failover
generic_resource_name lan1
generic_resource_evaluation_type before_package_start
dependency_name generic_resource_monitors
dependency_condition generic_resource_monitors = up
dependency_location same_node
Similarly, consider another package pkg2 that requires the 'CPU' to be configured as
before_package_start.
package_name pkg2
package_type failover
generic_resource_name cpu
generic_resource_evaluation_type before_package_start
generic_resource_name lan1
generic_resource_evaluation_type before_package_start
dependency_name generic_resource_monitors
dependency_condition generic_resource_monitors = up
dependency_location same_node
Thus, the monitoring scripts for all the generic resources of type
before_package_start are configured in one single multi-node package and any
package that requires this generic resource can just configure the generic resource name.
If a common resource has to be monitored in multiple packages, the monitoring scripts
can be configured in the multi-node package described above and multiple packages
can define the same generic resource name in their package configuration files as seen
for the generic resource 'lan1' in the above example.
342 Monitoring Script for Generic Resources