WebSphere® Application Server scripting commands use the underlying Java Management Extensions (JMX) classes, ObjectName, Attribute, and AttributeList, to manipulate object names, attributes and attribute lists respectively.
traceServ = AdminControl.completeObjectName('type=TraceService,process=server1,*')
The WebSphere Application Server ObjectName class uniquely identifies running objects.
The ObjectName class consists of the following elements:
- The domain name WebSphere.
- Several key properties, for example:
- type - Indicates the type of object that is accessible through the MBean, for example, ApplicationServer, and EJBContainer.
- name - Represents the display name of the particular object, for example, MyServer.
- node - Represents the name of the node on which the object runs.
- process - Represents the name of the server process in which the object runs.
- mbeanIdentifier - Correlates the MBean instance with corresponding configuration data.
When ObjectName classes are represented by strings, they have the following pattern:
[domainName]:property=value[,property=value]*
For example, you can specify WebSphere:name="My Server",type=ApplicationServer,node=n1,* to specify an application server named My Server. on node n1. (The asterisk (*) is a wildcard character, used so that you do not have to specify the entire set of key properties.)
Example
Obtain the object name with the completeObjectName
server1 = AdminControl.completeObjectName('node=mynode,type=Server,name=server1,*')
Obtain the object name with the queryNames command
server = AdminControl.queryNames('node=mynode,type=Server,name=server1,*')
If there are several MBeans that match the template, the completeObjectName command only returns the first match. The matching MBean object name is then assigned to a variable. If there are more than one running objects returned from the queryNames command, the objects are returned in a list syntax.
To display the operations for the server MBean
print Help.operations(server)
To Invoke the operation
traceServ = AdminControl.completeObjectName('type=TraceService,process=server1,*')
AdminControl.invoke(traceServ,'appendTraceString',"com.ibm.ws.management.*=all=enabled")
You can modify multiple attribute name and value pairs for server ts1
ts1 = AdminControl.completeObjectName('type=TraceService,process=server1,*')
AdminControl.setAttributes(ts1,[['ringBufferSize',10],['traceSpecification', 'com.ibm.*=all=disabled']])
Another way,
ts1 =AdminControl.completeObjectName('type=TraceService,process=server1,*')
AdminControl.setAttributes(ts1,'[[ringBufferSize 10] [traceSpecification com.ibm.*=all=disabled]]')
No comments:
Post a Comment