You can use the healthpolicy.py script to create, remove, and add and remove members from health policies.
The healthpolicy.py script is in the install_root\bin directory.
./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, you must have a configurator or an administrator administrative role.
Option | Description |
---|---|
Age condition parameters | |
--tt | Specifies the maximum age value. |
--tunits | |
--hrmode | Specifies an integer that represents
the reaction mode.
|
Work condition parameters | |
--reqs | Specifies a number of requests for the work policy. |
--hrmode | Specifies an integer that represents
the reaction mode.
|
Response time condition parameters | |
--tt | Specifies the maximum response time. |
--tunits | Specifies an integer that represents
one of the following time units:
|
--hrmode | Specifies an integer that represents
the reaction mode.
|
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:
|
--hrmode | Specifies an integer that represents
the reaction mode.
|
Memory leak condition parameters | |
--level | An integer that represents the level of leak
detection.
|
--hrs | Specifies an integer that represents the reaction
(depends on type). Separate multiple reactions with commas.
|
--hrmode | Specifies an integer that represents
the reaction mode.
|
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.
|
--hrmode | Specifies an integer that represents
the reaction mode.
|
Storm drain condition parameters | |
--level | An integer that represents the level of storm
drain detection
|
--hrmode | Specifies an integer that represents
the reaction mode.
|
Option | Description |
---|---|
--hpname | Specifies the unique name for the health policy that you want to remove. |
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:
|
Option | Description |
---|---|
--hpname | Specifies a name for the existing health policy that is unique in the cell. This health policy should contain the member that you want to remove. |
--mname | Specifies the name of the member that you want to remove. |
Use the following examples as a guide for managing your health policies with scripting.
Creating a health policy
./wsadmin.sh -lang jython -f healthpolicy.py createHealthPolicy --hpname Daily --hcond 0 --tt 1 --tunits 4
./wsadmin.sh -lang jython -f healthpolicy.py createHealthPolicy --hpname TenSec --hcond 2 --tt 10 --tunits 0 --hrmode 2
./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