Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS
healthpolicy.py script
You can use the healthpolicy.py script to create, remove, and add and remove members from health policies.
Purpose
With the healthpolicy.py script, you can:Deprecated feature: This script was valid for V6.0 releases. To configure the newer health policy features, use Health policy administrative tasks.depfeat
- Create a health policy.
- Remove a health policy.
- Add a member to an existing policy.
- Remove a member from an existing policy.
Location
The healthpolicy.py script is in the install_root\bin directory.
Usage
To run the healthpolicy.py script, run the following command:./wsadmin.sh -lang jython -f healthpolicy.py <operation> [options]Replace the <operation> [options] variables with the appropriate operation and options for your task.
To make changes to health policies, have a configurator or an administrator administrative role.
Operations
You can use the following operations with the healthpolicy.py script:
- createHealthPolicy
- Creates a new health policy with no members. You can add members later using the addMember operation.
Table 1. createHealthPolicy options Option Description --hpname Specifies a name for the health policy that is unique in the cell. --hcond Specifies an integer that represents one of the following health condition types:
- 0 = age
- 1 = work
- 2 = excessive response time
- 3 = excessive memory
- 4 = memory leak
- 5 = stuck request
- 6 = storm drain
--hrs Specifies an integer that represents the reaction (depends on type). Separate multiple reactions with commas.
- 0 = restart [default]
- 1 = thread dump
- 2 = heap dump
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
--hpd Specifies an optional description of the health policy.
Table 2. Condition-specific options Option Description Age condition parameters --tt Specifies the maximum age value. --tunits Specifies an integer that represents one of the following time units:
- 0 = milliseconds
- 1 = seconds
- 2 = minutes
- 3 = hours
- 4 = days
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Work condition parameters --reqs Specifies a number of requests for the work policy. --hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Response time condition parameters --tt Specifies the maximum response time. --tunits Specifies an integer that represents one of the following time units:
- 0 = milliseconds
- 1 = seconds
- 2 = minutes
- 3 = hours
- 4 = days
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Memory condition parameters --perc Specifies a percentage of heap size for the excessive memory policy. --tt Specifies the time over threshold for memory policy. --tunits Specifies an integer that represents one of the following time units:
- 0 = milliseconds
- 1 = seconds
- 2 = minutes
- 3 = hours
- 4 = days
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Memory leak condition parameters --level An integer that represents the level of leak detection.
- 0 = aggressive
- 1 = normal [default]
- 2 = conservative
--hrs Specifies an integer that represents the reaction (depends on type). Separate multiple reactions with commas.
- 0 = restart [default]
- 2 = heap dump
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Stuck request condition parameters --perc A timeout percentage for stuck request policy. --hrs Specifies an integer that represents the reaction (depends on type). Separate multiple reactions with commas.
- 0 = restart [default]
- 1 = thread dump
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
Storm drain condition parameters --level An integer that represents the level of storm drain detection
- 1 = normal [default]
- 2 = conservative
--hrmode Specifies an integer that represents the reaction mode.
- 2 = supervised [default]
- 3 = automatic
- removeHealthPolicy
- Deletes an existing health policy and takes the following option:
Table 3. removeHealthPolicy options Option Description --hpname Specifies the unique name for the health policy to remove. - addMember
- Adds a new member to an existing health policy and takes the following options:
Table 4. addMember options Option Description --hpname Specifies a name for the existing health policy that is unique in the cell. --mname Specifies a name for the member that you want to create. --mtype Specifies one of the following types of members:
- 1 = application server
- 2 = cluster
- 3 = dynamic cluster
- 4 = cell
- removeMember
- Removes a member from an existing health policy and takes the following options:
Table 5. removeMember options Option Description --hpname Specifies a name for the existing health policy that is unique in the cell. This health policy should contain the member to remove. --mname Name of the member that you want to remove.
Example
Use the following examples as a guide for managing your health policies with scripting.
Creating a health policy
- To create an age health policy with automated restart:
./wsadmin.sh -lang jython -f healthpolicy.py createHealthPolicy --hpname Daily --hcond 0 --tt 1 --tunits 4
- To create a response time health policy with a supervised restart:
./wsadmin.sh -lang jython -f healthpolicy.py createHealthPolicy --hpname TenSec --hcond 2 --tt 10 --tunits 0 --hrmode 2
- To create a memory leak policy with automated heap dumps:
./wsadmin.sh -lang jython -f healthpolicy.py createHealthPolicy --hpname Leaky --hconf 4 --hrs 0,1 -hpd 'memory leak policy'
Removing a health policy
./wsadmin.sh -lang jython -f healthpolicy.py removeHealthPolicy --hpname Daily
Adding a member to a health policy
./wsadmin.sh -lang jython -f healthpolicy.py addMember --hpname Daily --mtype 3 --mname TestClusterA
Removing a member from a health policy
./wsadmin.sh -lang jython -f healthpolicy.py removeMember --hpname Daily --mname TestClusterA
Related concepts
Health management
Related tasks
Creating health policies
Related reference
Administrative roles and privileges
Health policy administrative tasks