Use the following python script to administer service policies.
The servicepolicy.py script is located in the install_root\bin directory.
To create, modify, and
remove service policies and transaction classes, you must have configurator
or administrator administrative privileges.
To run the servicepolicy.py script with wsadmin, use the following command:
wsadmin.sh -lang jython -f servicepolicy.py operation [options]
Replace operation options variables with the appropriate operation and options for your task. You might have to modify the wsadmin command to wsadmin.bat, depending on your operating environment.
You can do the following operations with the servicepolicy.py script:
Option | Description |
---|---|
--spname | Specifies a name for the service policy that is unique in the cell. |
--spgt | Specifies an integer that represents one of the following
service policy goal types:
|
--spgv | Specifies a service policy goal value for non-discretionary goals. This is assumed to be milliseconds if the units are not specified. |
--spgvu | Optional: Specifies an integer that represents a
service policy goal value for non-discretionary goals. This is assumed to
be milliseconds if the units are not specified.
|
--sppgv | Specifies an integer that represents a percentile value for a service policy with percentile response time goal between 1 and 100. |
--spi | Specifies an integer that represents one of the following
service policy goal types:
|
--spd | Optional: Specifies a service policy description. |
Option | Description |
---|---|
--spname | Specifies the unique name for the service policy that you want to remove. |
Option | Description |
---|---|
--spname | Specifies a name for the service policy that is unique in the cell. |
--tcname | Specifies a name for the transaction class that you want to create that is unique in the cell. |
--tcd | Optional: Specifies a transaction class description. |
Option | Description |
---|---|
--tcname | Specifies the cell-unique name for the transaction class that you want to remove. |
Option | Description |
---|---|
--tcname | Specifies a name for the transaction class to which you want to add URIs. |
--appname | Specifies name of the application with which the URIs are associated. |
--modname | Specifies the name of the J2EE module within the application to which the URIs are associated. |
--uris | Specifies "uri1,uri2,..." the collection of URI patterns to associate with the transaction class from the application J2EE module pair. |
--validate | Optional: If this flag is provided, the URIs specified are checked to make sure they are not already mapped to an existing transaction class. |
Option | Description |
---|---|
--appname | Specifies name of the application with which the URIs are associated. |
--modname | Specifies name of the web module within the application. |
--tcname | Optional: Specifies a name for the transaction class to which you want to add URIs. If this is not specified, all transaction classes are searched. |
--uris | Optional: Specifies "uri1,uri2,..." the collection of URI patterns to associate with the transaction class from the application J2EE module pair. If this is not specified, all the URIs for the application and module {and optionally transaction class} are removed. |
Sample output from this script follows:
./wsadmin.sh -lang jython -f servicepolicy.py createServicePolicy --spname Bronze --spgt 2 --spgv 3000 --spgvu 0 --sppgv 80 --spi 5
./wsadmin.sh -lang jython -f servicepolicy.py removeServicePolicy --spname Platinum
./wsadmin.sh -lang jython -f servicepolicy.py createTransactionClass --spname Platinum --tcname PlatinumWorkload --tcd 'my platinum workload'
./wsadmin.sh -lang jython -f servicepolicy.py removeTransactionClass --tcname PlatinumWorkload
./wsadmin.sh -lang jython -f servicepolicy.py addUrisToTransactionClass --tcname PlatinumWorkload --appname StockTrade --modname trade.war --uris "/trade*.do, /trade*.jsp"
./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade --modname trade.war --tcname PlatinumWorkload --uris \"/trade*.do, /trade*.jsp\"
>> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade --modname trade.war --uris \"/trade*.do, /trade*.jsp\"
>> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade --modname trade.war --tcname PlatinumWorkload
>> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade --modname trade.war