Use the AdminControl object to invoke operational commands that manage objects for the application server.
Many of the AdminControl commands have multiple signatures so that they can either invoke in a raw mode using parameters that are specified by Java Management Extensions (JMX), or by using strings for parameters. In addition to operational commands, the AdminControl object supports some utility commands for tracing, reconnecting with a server, and converting data types.
Use the completeObjectName command to create a string representation of a complete ObjectName value that is based on a fragment. This command does not communicate with the server to find a matching ObjectName value. If the system finds several MBeans that match the fragment, the command returns the first one.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command does not return output.
Examples
set serverON [$AdminControl completeObjectName node=mynode,type=Server,*]
serverON = AdminControl.completeObjectName('node=mynode,type=Server,*')
Use the getAttribute command to return the value of the attribute for the name that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
'DeploymentManager'
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl getAttribute $objNameString processType
objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.getAttribute(objNameString, 'processType')
Use the getAttribute_jmx command to return the value of the attribute for the name that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
'DeploymentManager'
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] set objName [java::new javax.management.ObjectName $objNameString] $AdminControl getAttribute_jmx $objName processType
objNameString = AdminControl.completeObjectName('WebSphere:=type=Server,*') import javax.management as mgmt objName = mgmt.ObjectName(objNameString) print AdminControl.getAttribute_jmx(objName, 'processType')
Use the getAttributes command to return the attribute values for the names that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
'[ [cellName myCell01] [nodeName myCellManager01] ]'
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl getAttributes $objNameString "cellName nodeName"
objNameString = AdminControl.completeObjectname('WebSphere:type=Server,*) print AdminControl.getAttributes(objNameString, '[cellName nodeName]')
objNameString = AdminControl.completeObjectname('WebSphere:type=Server,*) print AdminControl.getAttributes(objNameString, ['cellName', 'nodeName'])
Use the getAttributes_jmx command to return the attribute values for the names that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command returns an attribute list.
Examples
set objectNameString [$AdminControl completeObjectName WebSphere:type=Server,*] set objName [$AdminControl makeObjectName $objectNameString] set attrs [java::new {String[]} 2 {cellName nodeName}] $AdminControl getAttributes_jmx $objName $attrs
objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) attrs = ['cellName', 'nodeName'] print AdminControl.getAttributes_jmx(objName, attrs)
Use the getCell command to return the name of the connected cell.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
Mycell
Examples
$AdminControl getCell
print AdminControl.getCell()
Use the getConfigId command to create a configuration ID from an ObjectName or an ObjectName fragment. Each MBean does not have corresponding configuration objects. If several MBeans correspond to an ObjectName fragment, a warning is created and a configuration ID builds for the first MBean that the system finds.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command returns a string that contains the configuration ID of interest.
Examples
set threadpoolCID [$AdminControl getConfigId node=mynode,type=ThreadPool,*]
set serverConfigId [$AdminControl getConfigId node=SY1,type=Server,*]
threadpoolCID = AdminControl.getConfigId('node=mynode,type=ThreadPool,*')
serverConfigId = AdminControl.getConfigId('node=SY1,type=Server,*')
Use the getDefaultDomain command to return the default domain name from the server.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
WebSphere
Examples
$AdminControl getDefaultDomain
print AdminControl.getDefaultDomain()
Use the getDomainName command to return the domain name from the server.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
WebSphere
Examples
$AdminControl getDomainName
print AdminControl.getDomainName()
Use the getHost command to return the name of your host.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
myHost
Examples
$AdminControl getHost
print AdminControl.getHost()
Use the getMBeanCount command to return the number of MBeans that are registered in the server.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
151
Examples
$AdminControl getMBeanCount
print AdminControl.getMBeanCount()
Use the getMBeanInfo_jmx command to return the Java Management Extension MBeanInfo structure that corresponds to an ObjectName value. No string signature exists for this command, because the Help object displays most of the information available from the getMBeanInfo_jmx command.
Target object
None.Required parameters
Optional parameters
None.Sample output
javax.management.modelmbean.ModelMBeanInfoSupport@10dd5f35
Examples
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objectNameString] $AdminControl getMBeanInfo_jmx $objName
objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.getMBeanInfo_jmx(objName)
Use the getNode command to return the name of the connected node.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
myNode01
Examples
$AdminControl getNode
print AdminControl.getNode()
Use the getObjectInstance command to return the object instance that matches the input object name.
Target object
None.Required parameters
Optional parameters
None.Sample output
javax.management.modelmbean.RequiredModelMBean
Examples
set server [$AdminControl completeObjectName type=Server,*] set serverOI [$AdminControl getObjectInstance $server]Use the following example to manipulate the return value of the getObjectInstance command:
puts [$serverOI getClassName]
server = AdminControl.completeObjectName('type=Server,*') serverOI = AdminControl.getObjectInstance(server)Use the following example to manipulate the return value of the getObjectInstance command:
print serverOI.getClassName()
Use the getPort command to return the name of the port used for the scripting connection.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
8877
Examples
$AdminControl getPort
print AdminControl.getPort()
The getPropertiesForDataSource command is deprecated, and no replacement exists. This command incorrectly assumes the availability of a configuration service when running in connected mode.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
WASX7389E: Operation not supported - getPropertiesForDataSource command is not supported.
Examples
set ds [lindex [$AdminConfig list DataSource] 0] $AdminControl getPropertiesForDataSource $ds
ds = AdminConfig.list('DataSource') # get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') dsArray = ds.split(lineSeparator) print AdminControl.getPropertiesForDataSource(dsArray[0])
Use the getType command to return the connection type used for the scripting connection.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
SOAP
Examples
$AdminControl getType
print AdminControl.getType()
Use the help command to return general help text for the AdminControl object.
Target object
None.Required parameters
None.Optional parameters
Sample output
WASX7027I: The AdminControl object enables the manipulation of MBeans that run in a WebSphere® Application Server process. The number and type of MBeans that are available to the scripting client depend
on the server to which the client is connected. If the client is connected to a deployment manager, then
all the MBeans running in the Deployment Manager are visible, as are all the MBeans running in the node agents
that are connected to this deployment manager, and all the MBeans that run in the application servers
on those nodes.
The following commands are supported by the AdminControl object; more detailed information about each of these
commands is available by using the "help" command of the AdminControl object and supplying the name
of the command as an argument.
Many of these commands support two different sets of signatures: one that accepts and returns strings, and one
low-level set that works with JMX objects like ObjectName and AttributeList. In most situations, the string
signatures are likely to be more useful, but JMX-object signature versions are supplied as well. Each of these
JMX-object signature commands has "_jmx" appended to the command name, so an "invoke" command, as well as a
"invoke_jmx" command are supported.
completeObjectName Return a String version of an object name given atemplate name
getAttribute_jmx Given ObjectName and name of attribute, returns value ofattribute
getAttribute Given String version of ObjectName and name of attribute, returns value of attribute
getAttributes_jmx Given ObjectName and array of attribute names, returns AttributeList
getAttributes Given String version of ObjectName and attribute names, returns String of name value pairs
getCell returns the cell name of the connected server
getConfigId Given String version of ObjectName, return a config id for the corresponding configuration
object, if any.
getDefaultDomain returns "WebSphere"
getDomainName returns "WebSphere"
getHost returns String representation of connected host
getMBeanCount returns number of registered beans
getMBeanInfo_jmx Given ObjectName, returns MBeanInfo structure for MBean
getNode returns the node name of the connected server
getPort returns String representation of port in use
getType returns String representation of connection type in use help help Show help information
invoke_jmx Given ObjectName, name of command, array of parameters andsignature, invoke command on MBean specified
invoke Invoke a command on the specified MBean
isRegistered_jmx true if supplied ObjectName is registered
isRegistered true if supplied String version of ObjectName is registered
makeObjectName Return an ObjectName built with the given string
queryNames_jmx Given ObjectName and QueryExp, retrieves set of ObjectNames that match.
queryNames Given String version of ObjectName, retrieves String of ObjectNames that match.
reconnect reconnects with serversetAttribute_jmx Given ObjectName and Attribute object, set attribute for
MBean specified
setAttribute Given String version of ObjectName, attribute name andattribute value, set attribute for MBean specified
setAttributes_jmx Given ObjectName and AttributeList object, set attributes for the MBean specified
startServer Given the name of a server, start that server.
stopServer Given the name of a server, stop that server.
testConnection Test the connection to a DataSource object
trace Set the wsadmin trace specification
WASX7043I: command: getAttribute Arguments: object name, attribute Description: Returns value of "attribute" for the MBean described by "object name."
Examples
$AdminControl help
$AdminControl help getAttribute
print AdminControl.help()
print AdminControl.help('getAttribute')
Use the invoke command to invoke a specific MBean operation based on the number of parameters that operation requires. If this constraint is not sufficient to select a unique operation, use invoke_jmx. The supplied parameters are converted to the object types required by the selected operation's signature before the operation is invoked. Any returned value is converted to its string representation.
Target object
None.Required parameters
Optional parameters
The arguments parameter is a single string. Each individual argument in the string can contain spaces.
Sample output
The command returns a string that shows the result of the invocation.
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl invoke $objNameString stop
set objNameString [$AdminControl completeObjectName WebSphere:type=DynaCache,*] $AdminControl invoke $mbean getCacheStatistics {"DiskCacheSizeInMB ObjectsReadFromDisk4000K RemoteObjectMisses"}
objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.invoke(objNameString, 'stop')
objNameString = AdminControl.completeObjectName("WebSpheretype=DynaCache,*") AdminControl.invoke(dc, "getCacheStatistics", '["DiskCacheSizeInMB ObjectReadFromDisk4000K RemoteObjectMisses"]')
objNameString = AdminControl.completeObjectName("WebSphere:type=DynaCache,*") AdminControl.invoke(dc, "getCacheStatistics", [["DiskCacheSizeInMB", "ObjectReadFromDisk4000K", "RemoteObjectMisses"]])
Use the invoke_jmx command to invoke the object operation by conforming the parameter list to the signature. The command returns the result of the invocation.
Target object
None.Required parameters
Optional parameters
Sample output
The command returns a string that shows the result of the invocation.
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [java::new javax.management.ObjectName $objNameString] set parms [java::new {java.lang.Object[]} 1 com.ibm.ejs.sm.*=all=disabled] set signature [java::new {java.lang.String[]} 1 java.lang.String] $AdminControl invoke_jmx $objName $parms $signature
objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = mgmt.ObjectName(objNameString) parms = ['com.ibm.ejs.sm.*=all=disabled'] signature = ['java.lang.String'] print AdminControl.invoke_jmx(objName, parms, signature)
Use the isRegistered command to determine if a specific object name is registered.
Target object
None.Required parameters
Optional parameters
None.Sample output
wsadmin>s = AdminControl.queryNames( 'type=Server,*' ).splitlines()[ 0 ] wsadmin>AdminControl.isRegistered( s ) 1 wsadmin>
If the ObjectName value is not registered in the server, then the value is 0.
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl isRegistered $objNameString
objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.isRegistered(objNameString)
Use the isRegistered_jmx command to determine if a specific object name is registered.
Target object
None.Required parameters
Optional parameters
None.Sample output
true
Examples
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objNameString] $AdminControl isRegistered_jmx $objName
objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.isRegistered_jmx(objName)
Use the makeObjectName command to create an ObjectName value that is based on the strings input. This command does not communicate with the server, so the ObjectName value that results might not exist. If the string you supply contains an extra set of double quotes, they are removed. If the string does not begin with a Java Management Extensions (JMX) domain, or a string followed by a colon, then the WebSphere Application Server string appends to the name.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command returns an Objectname object constructed from the object name string.
Examples
set objectNameString [$AdminControl completeObjectName type=Server,node=mynode,*] set objName [$AdminControl makeObjectName $objNameString]
objectNameString = AdminControl.completeObjectName('type=Server,node=mynode,*') objName = AdminControl.makeObjectName(objectNameString)
Use the queryMBeans command to query for a list of object instances that match the object name that you provide.
Target object
None.Required parameters
Optional parameters
Sample output
WebSphere:name=PlantsByWebSphere,process=server1,platform=dynamicproxy,node=Goodog, J2EEName=PlantsByWebSphere,Server=server1,version=6.1.0.0,type=Application, mbeanIdentifier=cells/GooddogNode02Cell/applications/PlantsByWebSphere.ear/ deployments/PlantsByWebSphere/deployment.xml#ApplicationDeployment_1126623343902, cell=GooddogNode02Cell
Examples
set apps [$AdminControl queryMBeans type=Application,*]
set appArray [$apps toArray] set app1 [java::cast javax.management.ObjectInstance [$appArray get 0]] puts [[$app1 getObjectName] toString]
set apps [$AdminControl queryMBeans type=Application,* [java::null]]Use the following example to manipulate the return value of the queryMBeans command:
set appArray [$apps toArray] set app1 [java::cast javax.management.ObjectInstance [$appArray get 0]] puts [[$app1 getObjectName] toString]
apps = AdminControl.queryMBeans('type=Application,*')
appArray = apps.toArray() app1 = appArray[0] print app1.getObjectName().toString()
apps = AdminControl.queryMBeans('type=Application,*',None)Use the following example to manipulate the return value of the queryMBeans command:
appArray = apps.toArray() app1 = appArray[0] print app1.getObjectName().toString()
Use the queryNames command to query for a list of each of the ObjectName objects based on the name template.
Target object
None.Required parameters
Optional parameters
None.Sample output
WebSphere:cell=BaseApplicationServerCell, name=server1,mbeanIdentifier=server1, type=Server,node=mynode,process=server1
Examples
$AdminControl queryNames WebSphere:type=Server,*
print AdminControl.queryNames('WebSphere:type=Server,*')
Use the queryNames_jmx command to query for a list of each of the ObjectName objects based on the name template and the query conditions that you specify.
Target object
None.Required parameters
Optional parameters
None.Sample output
[WebSphere:cell=BaseApplicationServerCell,name=server1,mbeanIdentifier= server1,type=Server,node=mynode,process=server1]
Examples
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objNameString] set null [java::null] $AdminControl queryNames_jmx $objName $null
objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.queryNames_jmx(objName, None)
Use the reconnect command to reconnect to the server, and to clear information out of the local cache.
Target object
None.Required parameters
None.Optional parameters
None.Sample output
WASX7074I: Reconnect of SOAP connector to host myhost completed.
Examples
$AdminControl reconnect
print AdminControl.reconnect()
Use the setAttribute command to set the attribute value for the name that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command returns does not return output.
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] $AdminControl setAttribute $objNameString traceSpecification com.ibm.*=all=disabled
objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') print AdminControl.setAttribute(objNameString, 'traceSpecification', 'com.ibm.*=all=disabled')
Use the setAttribute_jmx command to set the attribute value for the name that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command returns does not return output.
Examples
set objectNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [$AdminControl makeObjectName $objectNameString] set attr [java::new javax.management.Attribute traceSpecification com.ibm.*=all=disabled] $AdminControl setAttribute_jmx $objName $attr
objectNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = AdminControl.makeObjectName(objectNameString) attr = mgmt.Attribute('traceSpecification', 'com.ibm.*=all=disabled') print AdminControl.setAttribute_jmx(objName, attr)
Use the setAttributes command to set the attribute values for the object names that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
'[traceSpecification com.ibm.ws.*=all=enabled]'
Examples
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] $AdminControl setAttributes $objNameString {{traceSpecification com.ibm.ws.*=all=enabled}}
objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') AdminControl.setAttributes(objNameString, '[[traceSpecification "com.ibm.ws.*=all=enabled"]]')
objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') print AdminControl.setAttributes(objNameString, [['traceSpecification', 'com.ibm.ws.*=all=enabled']])
Use the setAttributes_jmx command to set the attribute values for the object names that you provide.
Target object
None.Required parameters
Optional parameters
None.Sample output
'[traceSpecification com.ibm.ws.*=all=enabled]'
Examples
set objectNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [$AdminControl makeObjectName $objectNameString] set attr [java::new javax.management.Attribute traceSpecification com.ibm.ws.*=all=enabled] set alist [java::new javax.management.AttributeList] $alist add $attr $AdminControl setAttributes_jmx $objName $alist
objectNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = AdminControl.makeObjectName(objectNameString) attr = mgmt.Attribute('traceSpecification', 'com.ibm.ws.*=all=enabled') alist = mgmt.AttributeList() alist.add(attr) print AdminControl.setAttributes_jmx(objName, alist)
Target object
None.Required parameters
Optional parameters
Sample output
Server launched. Waiting for initialization status. Server server1 open for e-business; process id is 1932.
Examples
$AdminControl startServer server1
$AdminControl startServer server1 100
$AdminControl startServer server1 myNode
$AdminControl startServer server1 myNode 100
AdminControl.startServer('server1')
AdminControl.startServer('server1', 100)
AdminControl.startServer('server1', 'myNode')
AdminControl.startServer('server1', 'myNode', 100)
Target object
None.Required parameters
Optional parameters
Sample output
WASX7337I: Invoked stop for server "server1" Waiting for stop completion. 'WASX7264I: Stop completed for server "server1" on node "myNode"'
Examples
$AdminControl stopServer server1
$AdminControl stopServer server1 immediate
$AdminControl stopServer server1 myNode
$AdminControl stopServer server1 myNode immediate
AdminControl.stopServer('server1','immediate')
AdminControl.stopServer('server1','myNode')
AdminControl.stopServer('server1','myNode','immediate')
Use the testConnection command to test a data source connection. This command works with the data source that resides in the configuration repository. If the data source to be tested is in the temporary workspace that holds the update to the repository, you must save the update to the configuration repository before running this command. Use this command with the configuration ID that corresponds to the data source and the WAS40DataSource object types.
Target object
None.Required parameters
Optional parameters
None.Sample output
WASX7217I: Connection to provided datasource was successful.
Examples
set ds [lindex [$AdminConfig list DataSource] 0] $AdminControl testConnection $ds
# get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') ds = AdminConfig.list('DataSource').split(lineSeparator)[0] print AdminControl.testConnection(ds)
Use the trace command to set the trace specification for the scripting process to the value that you specify.
Target object
None.Required parameters
Optional parameters
None.Sample output
The command does not return output.
Examples
$AdminControl trace com.ibm.ws.scripting.*=all=enabled
print AdminControl.trace('com.ibm.ws.scripting.*=all=enabled')