While attempting to answer a question on StackOverflow, I experimented a little with some wsadmin commands, so I thought I’d record what I discovered. (I work with the Jython, rather than JACL, versions of the commands mostly because I like the idea of picking up a little of a new programming language which has other uses.)
In this particular case, I wanted to discover runtime System.properties values for a running JVM, of which many are not items you configure explicitly with WebSphere. Thus, after looking at the AdminConfig object and determining that it only had visibility into what you’ve configured, I determined that the AdminControl object was needed.
Still, here are some AdminConfig commands that I’ve used and will likely have reason to use again:
server = AdminConfig.getid('/Server:MyServerName/') jvm = AdminConfig.list('JavaVirtualMachine',server) print AdminConfig.show(jvm) print AdminConfig.attributes('JavaVirtualMachine')
You can see where I previously used this approach to create JVM Custom Properties for Application Servers and to determine the (configured) maximum heap for a particular Application Server. (I’ll return to that latter case later.)
The AdminControl scripting object is used for operational control. It communicates with MBeans that represent live objects running a WebSphere® server process.
These commands allowed me to locate and query runtime WebSphere objects:
serverName = AdminControl.completeObjectName('WebSphere:type=Server,process=MyServerName,*') print AdminControl.getAttributes(serverName, '[cellName nodeName]')
Or skip straight to the JVM:
jvmName = AdminControl.completeObjectName('WebSphere:type=JVM,process=MyServerName,*') AdminControl.invoke(jvmName,'getProperty','user.timezone')
Or, returning to the maximum heap case from before, now I can see the maximum heap of a JVM even if I haven’t explicitly configured one. Either of these variations, invoking a getter method, or getting an attribute, does the same thing:
Finally, here’s a way to see which attributes and operations are available for a particular object:
print Help.attributes(jvmName) print Help.operations(jvmName)