From: http://weblogic-wonders.com/weblogic/2011/03/23/application-state-monitoring-using-wlst/

There are scenarios when you would want to monitor the Application state of the currently deployed applications in the Domain using the WebLogic Server Runtime Mbeans. Properties like Application State.
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 Application State deployed in the domain.
Steps:
1. Script to monitor Application Runtime States
a. Save the below script ApplicationStatus.py on to your local machine.
**************************

connect(‘weblogic’,’weblogic’,’t3://localhost:8001′)
domainRuntime()
cd(‘AppRuntimeStateRuntime/AppRuntimeStateRuntime’)
AppList = cmo.getApplicationIds()
print ‘####### Application ####### Application Staten’
print ‘*****************n’
for App in AppList:
print ‘#######’,App ,’ #######’, cmo.getIntendedState(App)
print ‘*
****************n’

**************************
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 ApplicationStatus.py

Downloads

You can download the WLST script from the below link.

ApplicationStatus.py BeanSoft.biz本地镜像下载: ApplicationStatus.py

Note: Rename the file as ApplicationStatus.py

References:

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

Regards,
Wonders Team.

转载请注明:WebLogic Android 博客 » 使用WLST监控应用状态[转]