Sie sind auf Seite 1von 6

Using the Event Monitoring Service (Optional)

HP-UX Lab 14

Objectives
After completing this lab, you should be able to:

Create an HP Serviceguard packages with resource monitoring Modify a package to use resource monitoring

Requirement
This lab requires a two-node cluster running HP-UX.

Rev. 6.11

L14 1

Implementing and Supporting Serviceguard for HP-UX

Exercise 1 Creating a package with resource monitoring


1. The EMS-Core (version A.04.20) software should be installed on the nodes in your cluster when they are initially loaded. Confirm that this is the case by running the following command on both systems:
# swlist |grep EMS-Core

You should see something like the following:


EMS-Core A.04.20 EMS Core Product

2.

Using resls(1M) command, list some of the resources that can be monitored on each system in order to familiarize yourself with what is possible using EMS. ............................................................................................................. ............................................................................................................. ............................................................................................................. ............................................................................................................. .............................................................................................................

3.

Now you will set up a package that relies on information produced by EMS to mornitor one of its resources. Create and configure a new package (pkg_net) with a resource dependency on the state of the lan0 interface. Edit the package configuration file for this package so that the resource values are as follows:
PACKAGE_NAME NODE_NAME RUN_SCRIPT HALT_SCRIPT SUBNET_NAME RESOURCE_NAME RESOURCE_POLLING_INTERVAL RESOURCE_UP_VALUE pkg_net * /etc/cmcluster/pkg_net/pkg_net.cntl /etc/cmcluster/pkg_net/pkg_net.cntl 192.168.0.0 /net/interfaces/lan/status/lan0 30 UP

Note Setting these values for the package will cause the package to monitor the status of lan0; if that interface goes down, the package will switch.

L14 2

Rev. 6.11

Using the Event Monitor Service (Optional)

4.

Edit the package control file for this package so that the resource values are:
IP[0]=192.168.XXX.XXX SUBNET[0]=192.168.0.0

Important In the package control file modification outlined here, replace <192.168.XXX.XXX> with the assigned relocatable local network address of your cluster. To determine this address, go to the HPVL User Interface system, log on to one of the systems in your cluster, select the FAQ option, and look through that information for the values of the relocatable IP addresses assigned to your cluster. Ask your instructor if you do not know to obtain or cannot find this information. Do not use any other IP address.

To accomplish the task of adding the package, enter the following commands on Node1:
node1# node1# node1# node1# node1# node1# node1# node1# node1# node1# node1# node1# mkdir /etc/cmcluster/pkg_net cd /etc/cmcluster/pkg_net cmmakepkg pkg_net.conf cmmakepkg s pkg_net.cntl vi pkg_net.conf vi pkg_net.cntl cd /etc/cmcluster cmcheckconf v P pkg_net/pkg_net.conf cmapplyconf v P pkg_net/pkg_net.conf cmmodpkg e pkg_net cmrunpkg pkg_net cmviewcl v

You should see something that resembles the following when you run cmviewcl:
PACKAGE pkg_net STATUS up STATE running AUTO_RUN disabled NODE rx26-159

Policy_Parameters: POLICY_NAME CONFIGURED_VALUE Failover configured_node Failback manual Script_Parameters: ITEM STATUS MAX_RESTARTS RESTARTS Resource up /net/interfaces/lan/status/lan0 Subnet up Node_Switching_Parameters: NODE_TYPE STATUS SWITCHING Primary up enabled Alternate up enabled NAME 192.168.0.0

NAME rx26-159 (current) rx26-160

5.

Verify that the package switches when lan0 becomes unavailable by using the HPVL User Interface to disable the interface on Node1.

Rev. 6.11

L14 3

Implementing and Supporting Serviceguard for HP-UX

Exercise 2 Modifying a package to use resource monitoring


1. Modify the package created in the preceding exercise to add a resource dependency such that the /var filesystem must have a minimum of 100MB available for the package to continuing running on that node. You will need to add the following lines to the package configuration file:
RESOURCE_NAME RESOURCE_POLLING_INTERVAL RESOURCE_UP_VALUE /system/filesystem/availMb/var 30 > 100

Can these modifications be performed with the package running? With the cluster running? ............................................................................................................. To accomplish the task of adding the package, enter the following commands on Node1:
node1# cd /etc/cmcluster node1# vi pkg_net/pkg_net.conf node1# cmcheckconf v P pkg_net/pkg_net.conf node1# cmapplyconf v P pkg_net/pkg_net.conf node1# cmmodpkg e pkg_net node1# cmrunpkg pkg_net node1# cmviewcl v

You should see something that resembles the following when you run cmviewcl:
PACKAGE pkg_net STATUS up STATE running AUTO_RUN enabled NODE rx26-159

Policy_Parameters: POLICY_NAME CONFIGURED_VALUE Failover configured_node Failback manual Script_Parameters: ITEM STATUS MAX_RESTARTS RESTARTS Resource up /net/interfaces/lan/status/lan0 Resource up /system/filesystem/availMb/var Subnet up Node_Switching_Parameters: NODE_TYPE STATUS SWITCHING Primary up enabled Alternate up enabled NAME

192.168.0.0

NAME rx26-159 (current) rx26-160

L14 4

Rev. 6.11

Using the Event Monitor Service (Optional)

2.

To simulate a situation where the monitored filesystem gradually fills up with files and data, you will make a large file using the tar command. Run the following command on the node that your package is running on:
# tar cf /var/usr.tar /usr/. >/dev/null 2>&1 &

3.

While the tar command is running, you can use the bdf command to watch as the amount of free space on the monitored filesystem drops. Eventually, the file system will fill completely, which will cause the amount of free space to drop below the 100MB threshold. Verify that the package has switched over to the other node by running cmviewcl on either node. You should see something thatresembles the following:

PACKAGE pkg_net

STATUS up

STATE running

AUTO_RUN enabled

NODE rx26-160

Policy_Parameters: POLICY_NAME CONFIGURED_VALUE Failover configured_node Failback manual Script_Parameters: ITEM STATUS MAX_RESTARTS RESTARTS Resource up /net/interfaces/lan/status/lan0 Resource up /system/filesystem/availMb/var Subnet up Node_Switching_Parameters: NODE_TYPE STATUS SWITCHING Primary up enabled Alternate up enabled NAME

192.168.0.0

NAME rx26-159 rx26-160 (current)

Note the value for the monitored resource in the preceding output. 4. Remove the tar file from /var by running the following command on the node that was originally running the package:
# rm /var/usr.tar

Rev. 6.11

L14 5

Implementing and Supporting Serviceguard for HP-UX

L14 6

Rev. 6.11