Monitoring WebLogic Server Runtime using WLST

There are scenarios when you would want to monitor the properties of your alive servers in the Domain using the WebLogic Server Runtime Mbeans. Properties like Server State, Server Health, Listen Port, Listen Addresses etc.

This can be achieved through many ways like the Admin Console, JMX code, WLST scripts etc. WLST allows us to automate the monitoring.

WebLogic Server runtime MBeans are arranged in a hierarchical data structure. When connected to an Administration Server, you access the runtime MBean hierarchy by entering the serverRuntime or the domainRuntime command. The serverRuntime command places WLST at the root of the server runtime management objects, ServerRuntimeMBean; the domainRuntime command, at the root of the domain-wide runtime management objects, DomainRuntimeMBean. When connected to a Managed Server, the root of the runtime MBeans is ServerRuntimeMBean. The domain runtime MBean hierarchy exists on the Administration Server only; you cannot use the domainRuntimecommand when connected to a Managed Server.

The below post depicts the usage of WLST to monitor the Server State of all the running servers in the domain.

Steps:

1. Script to monitor Server Runtime States

a. Save the below script ServerStatus.py on to your local machine.

**************************************************************************

 

username = 'weblogic'
password = 'weblogic'
URL='t3://localhost:8001'
connect(username,password,URL)
domainRuntime()
cd('ServerRuntimes')
servers=domainRuntimeService.getServerRuntimes()
for server in servers:
serverName=server.getName();
print '**************************************************\n'
print '##############    ', serverName,    '###############'
print '**************************************************\n'
print '##### Server State           #####', server.getState()
print '##### Server ListenAddress   #####', server.getListenAddress()
print '##### Server ListenPort      #####', server.getListenPort()
print '##### Server Health State    #####', server.getHealthState()

 

**************************************************************************

2. Execute the WLST Script

a.  Set the CLASSPATH by running the setDomainEnv script from the

Alternatively you can set the CLASSPATH by specifying the –cp argument while executing the WLST Script

For Ex:  java –cp $BEA_HOME/wlserver_10.3/server/lib/weblogic.jar  weblogic.WLST ServerStatus.py

Downloads

You can download the WLST script from the below link.

ServerStatus.py

Note: Save the script as ServerStatus.py

References:

http://download.oracle.com/docs/cd/E11035_01/wls100/config_scripting/monitoring.html

Regards,

Wonders Team. :)

Latest Comments

  1. Ashok March 18, 2011
  2. Administrator March 22, 2011
  3. Suresh March 23, 2011
    • Administrator March 23, 2011
    • anandraj March 23, 2011
  4. Al March 24, 2011
  5. Naveeen July 13, 2011
  6. Pawan November 1, 2011
    • Shubhendu October 20, 2014
  7. Lokesh December 9, 2011
    • Administrator February 3, 2012
  8. Per July 25, 2012
  9. Adi December 4, 2012
  10. Adi December 4, 2012
  11. Chandra August 21, 2014
  12. kk November 20, 2014
    • Administrator November 24, 2014

Leave a Reply