WebSphere Extended Deployment, Version 6.0.x
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


Managing service policies with scripts

Use the following python script to administer service policies.

Purpose

You can do the following with this script:

Location

The servicepolicy.py script is located in the install_root\bin directory.

Usage

[Version 6.0.1 and later] 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.

Operations

You can do the following operations with the servicepolicy.py script:

createServicePolicy
Creates a service policy with the specified options. You must create and associate transaction classes separately.
Table 1. createServicePolicy options
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:
  • 0 = discretionary
  • 1 = average response time
  • 2 = percentile response time
--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.
  • 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

Optional: Specifies a service policy description.

removeServicePolicy
Deletes an existing service policy and takes the following option:
Table 2. removeServicePolicy option
Option Description
--spname Specifies the unique name for the service policy that you want to remove.
createTransactionClass
Creates a transaction class and takes the following options:
Table 3. createTransactionClass options
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.
removeTransactionClass
Removes a transaction class. All 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. Takes the following option:
Table 4. removeTransactionClass option
Option Description
--tcname Specifies the cell-unique name for the transaction class that you want to remove.
addUrisToTransactionClass (for WebSphere Extended Deployment 5.1 users only)
Adds a set of URIs associated with a specific application and J2EE module pair with an existing transaction class. The URIs should not include the context root of the URI. The context root of the URI is automatically associated with the URI because the application and module is specified. If the validate flag is specified, each URI pattern is checked to see if it is mapped to an existing transaction class (exaction match); otherwise it is assumed that the URI pattern is not mapped and the URI pattern is added to the transaction class without any validation. Takes the following options:
Table 5. addUrisToTransactionClass options
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.

removeUrisFromTransactionClass (for WebSphere Extended Deployment 5.1 users only)
Removes a set of URIs associated with an application and a web module and optionally a specific transaction class. The URIs should not include the context root of the URI, and exact matches are used for removal. Takes the following options:
Table 6. removeUrisFromTransactionClass options
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.

Example

Sample output from this script follows:

createServicePolicy
./wsadmin.sh -lang jython -f servicepolicy.py createServicePolicy --spname Bronze --spgt 2 
--spgv 3000 --spgvu 0 --sppgv 80 --spi 5 
removeServicePolicy
./wsadmin.sh -lang jython -f servicepolicy.py removeServicePolicy --spname Platinum  
createTransactionClass
./wsadmin.sh -lang jython -f servicepolicy.py createTransactionClass --spname Platinum --tcname 
PlatinumWorkload --tcd 'my platinum workload'
 removeTransactionClass
./wsadmin.sh -lang jython -f servicepolicy.py removeTransactionClass --tcname PlatinumWorkload  
addUrisToTransactionClass
./wsadmin.sh -lang jython -f servicepolicy.py addUrisToTransactionClass --tcname 
PlatinumWorkload --appname StockTrade --modname trade.war --uris "/trade*.do, /trade*.jsp"
removeUrisFromTransactionClass
  • Unmap from a specific transaction class a specific set of URIs associated with a specific application and web module:
    ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade 
    --modname trade.war --tcname PlatinumWorkload --uris \"/trade*.do, /trade*.jsp\"  
  • Unmap from any transaction class a specific set of URIs associated with a specific application and web module:
     >> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade 
    --modname trade.war --uris \"/trade*.do, /trade*.jsp\"  
  • Unmap from a specific transaction class all URIs associated with a specific application and web module:
     >> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade 
    --modname trade.war --tcname PlatinumWorkload
  • Unmap from any transaction class all URIs associated with a specified application and web module:
    >> ./wsadmin.sh -lang jython -f servicepolicy.py removeUrisFromTransactionClass --appname StockTrade 
    --modname trade.war  



Related tasks
Defining a service policy
Related reference
Reference topic    

Terms of Use | Feedback

Last updated: Nov 30, 2007 4:05:14 PM EST
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r0/index.jsp?topic=/com.ibm.websphere.xd.doc/info/reference/rxml_servicepolicy.html