Health management policies for Liberty

You can define the health policies, which include the health conditions that you want to monitor in your environment and the health actions to take if these conditions are met.

About this task

Health policies are configured in the same manner as other Liberty features. Within the server.xml file configuration, a new element type of <healthPolicy> is used to define a single health policy. If more than one policy is needed, multiple health policy elements can be added to the server.xml file.

Procedure

  1. Insert the health policy into the server.xml file and provide an identity for the health policy.
  2. Add the desired target elements to the health policy stanza in the server.xml file.
    Note: More than one target can be specified per health policy.
  3. Specify the condition that is being monitored within the health policy stanza.
    Note: Only one condition per policy is allowed.
  4. Specify the actions within the health policy stanza.
    Note: You can specify more than one action per health policy. If more than one action is specified, the actions are run in the order they are defined in the policy.

    For more information about health policy target elements, see Health management.

Example

In this example, the health policy specifies that all servers in cluster mycluster1 and all servers on host myHost are monitored for excessive memory usage. The policy monitors the excessiveMemoryUsage condition based on the specified thresholds. The policy instructs the health management controller to place the server experiencing the excessive memory usage into maintenance mode and request a heap dump from that server.

<healthPolicy id="myHealthPolicy" >
 <cluster clusterName="mycluster1"/>
 <host hostName="myHost"/>
 <excessiveMemoryUsage heapSizePercentage="85" timePeriod="5m"/>
 <action action="enterMaintenanceMode"/>
 <action action="generateHeapDump"/>
</healthPolicy>
When a health policy is added, the following messages display in any order in the messages.log file of the collective controller.
CWWKV0609I: The health policy myHealthPolicy is added.
CWWKV0603I: The health condition com.ibm.ws.health.manager.healthPolicy.condition.excessiveMemoryUsage is being monitored on target member_host_name,path_to_usr_directory,member_name.
CWWKV0607I: The health policy myHealthPolicy is activated for member_host_name,path_to_usr_directory,member_name.
Note: Messages CWWKV0603I and CWWKV0607I display when there is at least one member server in the collective that is identified in a target element.
When a health policy is modified, the following messages display in any order in the messages.log file of the collective controller.
CWWKV0610I: The health policy myHealthPolicy is removed.
CWWKV0604I: The health condition com.ibm.ws.health.manager.healthPolicy.condition.excessiveMemoryUsage is no longer being monitored on target member_host_name,path_to_usr_directory,member_name.
CWWKV0609I: The health policy myHealthPolicy is added.
CWWKV0603I: The health condition com.ibm.ws.health.manager.healthPolicy.condition.excessiveMemoryUsage is being monitored on target member_host_name,path_to_usr_directory,member_name.