This is an extension to my earlier post which gives the runtime attributes about the alive servers.
However there could be scenarios where you might want to keep a track of all the server states like RUNNING, SHUTDOWN etc in the domain.
The below WLST script provides a list of all the servers in the domains and their respective server states. To check the servers which are in shutdown state.
1. Script to monitor all the Server States in the domain.
a. Save the below script AllServerStatus.py on to your local machine.
username = 'weblogic' password = 'weblogic1' URL='t3://localhost:7001' connect(username,password,URL) domainConfig() serverList=cmo.getServers(); domainRuntime() cd('/ServerLifeCycleRuntimes/') for server in serverList: name=server.getName() cd(name) serverState=cmo.getState() if serverState=='SHUTDOWN': print '**** Shutdown Servers ****' print 'Server *****'+ name +'***** State *****'+serverState break print 'Server *****'+ name +'***** State *****'+serverState cd('..')
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 AllServerStatus.py
You can download the WLST script from the below link.
Note: Save the script as AllServerStatus.py
that script has syntax errors
It might be due to formatting.. it worked fine for me..
Comments are closed.