E Using PRM with Serviceguard

The optional HP product Serviceguard provides users and applications with a high availability environment. Serviceguard makes this environment possible by moving applications from one server to another when the original server or application session is unable to complete the desired jobs. You can set up PRM to control applications on the primary server and on a secondary server in the event of a failover. Such a set up requires a Serviceguard package control script that consists of the applications that PRM controls and a customer-defined function to control PRM.

Specify applications that PRM should control using the SERVICE_CMD[] variable in the package control script. When specifying an application, be sure to launch the application under PRM control using the prmrun command. For example, the following line launches application in the PRM group math_dept.

SERVICE_CMD[0]=”/opt/prm/bin/prmrun -g math_deptapplication

NOTE: If application records in your PRM configuration reference executable files that are unavailable due to being on a filesystem that is part of a Serviceguard package that is not available, PRM ignores the application records. Reload the PRM configuration with prmconfig when the filesystem is present for the application records to take effect. To automate the reload, you could place the prmconfig command toward the end of the Serviceguard package script.

An example of a customer-defined function is given on the following pages. It performs the following tasks:

1.Checks to see if PRM is installed.

2.If PRM is installed, it checks for the desired configuration file.

3.If the desired configuration file is not found, it is created.

4.Checks to see if PRM is configured.

5.If PRM is not already configured, the desired configuration is loaded.

6.If PRM is already configured, the configuration is checked for the group math_dept. This is the group the application should run in. If math_dept is not found, a warning is issued. Because math_dept is not available, the Serviceguard package will be started in the PRM group it is assigned in the PRM configuration.

7.If the math_dept group exists already, the configuration is logged for future reference. The Serviceguard package will run in the math_dept group.

Here is the example control function:

#START OF CUSTOMER DEFINED FUNCTIONSfunction customer_defined_run_cmds

{

#customer defined run commands.

UNAME=`uname -n`

# check to make sure prm is installed

if [ -f /opt/prm/bin/prmconfig ] then

# check that our prm config file is there; if not, create it

if [ ! -f /etc/opt/prm/conf/Serviceguard ] then

cat > /etc/opt/prm/conf/Serviceguard << EOF1

#

#sample Serviceguard PRM config file for a university

#groups

OTHERS:1:10:: math_dept:2:40:: computer_dept:3:50::

127

Page 127
Image 127
HP Process Resource Manager (PRM) Using PRM with Serviceguard, SERVICECMD0=/opt/prm/bin/prmrun -g mathdeptapplication