servicepolicy.py script
We can use the servicepolicy.py script to perform operations on service policies from the command line, such as creating service policies, removing service policies, and editing transaction classes.
Purpose
We can complete the following actions with the servicepolicy.py script.
- Create a service policy
- Remove a service policy
- Create a transaction class
- Remove a transaction class
To create, modify, and remove service policies and transaction classes, you must have configurator or administrator administrative privileges.
Location
The servicepolicy.py script is located in the app_server_root/bin directory.
Usage
The script usage for general help follows:
./wsadmin.sh -lang jython -f servicepolicy.py
The script usage for operation-specific help follows:
./wsadmin.sh -lang jython -f servicepolicy.py operation --help
Operations
- createServicePolicy
- Creates a service policy with the specified options. Create and associate transaction classes separately.
- -spname: 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:
- 0: discretionary
- 1: average response time
- 2: percentile response time
- 4: completion time
- -spgv: Specifies a service policy goal value for non-discretionary goals. This value is assumed to be in milliseconds if we do not specify the units.
- -spgvu: Specifies an integer that represents a service policy goal value for non-discretionary goals. This value is assumed to be in milliseconds if we do not specify the units.
- 0: milliseconds
- 1: seconds
- 2 : minutes
- -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:
- 1: highest
- 2: higher
- 3: high
- 4: medium
- 5: low
- 6: lower
- 7: lowest
- -spd: Specifies a service policy description.
- removeServicePolicy
- Delete an existing service policy with the specified option.
- -spname: Unique name for the service policy to remove.
- createTransactionClass
- Creates a transaction class with the specified options.
- -spname: Name for the service policy that is unique in the cell.
- -tcname: Name for the transaction class to create that is unique in the cell.
- -tcd: Specifies a transaction class description.
- removeTransactionClass
- Removes a transaction class with the specified option. All Uniform Resource Identifiers (URIs) in the transaction class are no longer associated with the parent service policy. If a request comes in for these URIs and they are not associated with a new service policy and transaction class, they are classified to the default service policy with a discretionary goal.
- -tcname: Cell-unique name for the transaction class to remove.
Example
Create a service policy:
./wsadmin.sh -lang jython -f servicepolicy.py createServicePolicy --spname Platinum --spgt 2 --spgv 3000 --spgvu 0 --sppgv 80 --spi 5
Remove an existing service policy:
./wsadmin.sh -lang jython -f servicepolicy.py removeServicePolicy --spname Bronze
Create a new transaction class:
./wsadmin.sh -lang jython -f servicepolicy.py createTransactionClass --spname Platinum --tcname PlatinumWorkload --tcd 'my platinum workload'
Remove an existing transaction class:
./wsadmin.sh -lang jython -f servicepolicy.py removeTransactionClass --tcname PlatinumWorkload
Related tasks
Define a service policy
Intelligent Management: administrative roles and privileges