Artwork implying World Wide Web Architecture

Short Diagnostic Scripts that Explore the MBeans that Control a WAS Server

Part of the WAS v6.1 Administration Series Series
Most recently modified on 2008-07-29
Back to home pageBack to articles page

Think of a Server as a layer cake. On the bottom is a Java Virtual Machine (JVM). IBM puts a JVM MBean in front of this layer. Above that is IBM's implementation of the J2EE spec. IBM puts a Server MBean in front of that implementation. Above that, your applications run.

The following tables illustrate some of the things you can do with the Server layer of an application server. The Server layer is IBM's implementation of Sun's J2EE spec

The following lines of python script are needed to prepare for the one line scripts below

line of codedescription
raw = AdminControl.queryNames( "type=Server,*" )This gets you the names of each of the MBeans that control each server in your cell.
array = raw.splitlines()Convert the text you got in the previous line into a Python array
theChosenMBean = array[0]Pick which ever Server you want to use in the code below. There will be one element in the array for every Server in your cell

Run any one of the lines below after you run the setup code above

line of codedescription
print Help.attributes( theChosenMBean )Find out all the attributes you can read with this MBean
print Help.operations( theChosenMBean )Find out everything you can do with this MBean
AdminControl.invoke( theChosenMBean, 'getVersionForAllProducts' )Get version information
AdminControl.invoke( theChosenMBean, 'getVersionForAllComponents' )Get version information
AdminControl.invoke( theChosenBean, 'getDeployedObjects' )Find everything that is deployed on this Server
AdminControl.invoke( theChosenBean, 'getResources' )Find out what resources on this Server

The following tables illustrate some of the things you can do with the Java Virtual Machine layer of an application server

The following lines of python script are needed to prepare for the one line scripts below. Notice that all we changed is the type of MBean that we search for. This time, we search for a JVM type MBean instead of a Server type MBean

line of codedescription
raw = AdminControl.queryNames( "type=JVM,*" )This gets you the names of each of the MBeans that control each server in your cell.
array = raw.splitlines()Convert the text you got in the previous line into a Python array
theChosenMBean = array[0]Pick which ever Server you want to use in the code below. There will be one element in the array for every Server in your cell

Run any one of the lines below after you run the setup code above

line of codedescription
print Help.attributes( theChosenMBean )Find out all the attributes you can read with this MBean
print Help.operations( theChosenMBean )Find out everything you can do with this MBean
AdminControl.invoke( theChosenMBean, 'generateHeapDump' )Generate a heap dump from the Server behind this MBean
AdminControl.invoke( theChosenMBean, 'dumpThreads' )Generate a thread dump from the Server behind this MBean
AdminControl.invoke( theChosenMBean, 'getStats' )Get memory and CPU usage information about the Server behind this MBean
AdminControl.invoke( theChosenMBean, 'getVersionForAllComponents' )Get version information

Photo of the author

Arthur Kevin McGrath

Bio:

The author is an engineer with the consulting firm, Contract Engineers. He has consulted and lectured extensively since 1987 about the infrastructure that makes electronic commerce possible

To schedule a speaker at your location, write speakers@edu4eng.com
To inquire about consulting for your company, write consultants@edu4eng.com
To inquire about training for your company, write training@edu4eng.com