Artwork implying World Wide Web Architecture

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

Part of the WebSphere Application Server v7.x Administration Series Series
Most recently modified on 2009-08-13
Back to home pageBack to articles page.
Chapters 9 and 11, Websphere Application Server Administration Using JythonOverview of MBeans

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

  • 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 whichever Server you want to use in the code below. There will be one element in the array for every Server MBean in your cell
  • line of codedescription

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

  • 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
  • line of codedescription

    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

  • 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 whichever Java virtual machine you want to use in the code below. There will be one element in the array for every JVM in your cell
  • line of codedescription

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

  • 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
  • line of codedescription

    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. His publications include Leading Practices for WebSphere Dynamic Process Edition V6.2 (SG24-7776-00) and Websphere Application Server Administration Using Jython (ISBN 0137009526), the definitive book on WAS scripting.

    Photo of the author
    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