下列 Jython script 可以用來管理性能原則。
healthpolicy.py script 是位於 <install_root>\bin 目錄中。
若要執行 healthpolicy.py script, 請執行下列指令:
./wsadmin.sh -lang jython -f healthpolicy.py <operation> [options]
請將 <operation> [options] 變數改為適當的作業以及適合您的作業之選項。
healthpolicy.py script 可以用於下列作業:
選項 | 說明 |
---|---|
經歷時間狀況參數 | |
--tt | 指定經歷時間值上限。 |
--tunits | |
--hrmode | 指定一個代表回應模式的整數。
|
工作狀況參數 | |
--reqs | 指定工作原則的要求數目。 |
--hrmode | 指定一個代表回應模式的整數。
|
回應時間狀況參數 | |
--tt | 指定回應時間上限。 |
--tunits | 指定一個整數,代表下列其中一種時間單位:
|
--hrmode | 指定一個代表回應模式的整數。
|
記憶體狀況參數 | |
--perc | 指定過多記憶體原則的資料堆大小百分比。 |
--tt | 指定記憶體原則的臨界值時間。 |
--tunits | 指定一個整數,代表下列其中一種時間單位:
|
--hrmode | 指定一個代表回應模式的整數。
|
記憶體洩漏狀況參數 | |
--level | 代表洩漏偵測層次的整數。
|
--hrs | 指定一個代表回應的整數(視類型而定)。
請使用逗點分隔多個回應。
|
--hrmode | 指定一個代表回應模式的整數。
|
停擺要求狀況參數 | |
--perc | 停擺要求原則的逾時百分比。 |
--hrs | 指定一個代表回應的整數(視類型而定)。
請使用逗點分隔多個回應。
|
--hrmode | 指定一個代表回應模式的整數。
|
猛烈枯竭狀況參數 | |
--level | 代表猛烈枯竭偵測層次的整數。
|
--hrmode | 指定一個代表回應模式的整數。
|
選項 | 說明 |
---|---|
--hpname | 指定要移除的性能原則之唯一名稱。 |
選項 | 說明 |
---|---|
--hpname | 指定在 Cell 內是唯一的現有性能原則名稱。 |
--mname | 指定要建立的成員名稱。 |
--mtype | 指定下列其中一種成員類型:
|
選項 | 說明 |
---|---|
--hpname | 指定在 Cell 內是唯一的現有性能原則名稱。 此性能原則必須包含您要移除的成員。 |
--mname | 指定要移除的成員名稱。 |
請使用下列範例,作為使用 Scripting 來管理性能原則時的指南。
建立性能原則
./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'
移除性能原則
./wsadmin.sh -lang jython -f healthpolicy.py removeHealthPolicy --hpname Daily
新增成員至性能原則
./wsadmin.sh -lang jython -f healthpolicy.py addMember --hpname Daily --mtype 3 --mname TestClusterA
從性能原則移除成員
./wsadmin.sh -lang jython -f healthpolicy.py removeMember --hpname Daily --mname TestClusterA