Script: get running/active servers in weblogic (wlst/python)

By | March 27, 2019
  • Given a weblogic server.
  • We would like to get list of running servers in current domain using python script.
  • We would following the trailing steps to get list of active servers (WLST).
    • Connect to admin server using t3 protocol.
    • Get list of all servers (RUNNING, SHUTDOWN, STARTING etc) in current domain.
    • Loop through all servers to filter out RUNNING servers.
    • Disconnect from admin server

Script: List of running servers in weblogic domain (WLST/example)

def runningServers():

    #Get list of servers in current domain
    servers = cmo.getServers()
    print "List of running servers in current domain: "
    for server in servers:
        cd("/ServerLifeCycleRuntimes/" + server.getName())
        state = cmo.getState()
        if state == "RUNNING":
            print server.getName()
    print "End of script"




Output – List server status in weblogic domain (WLST/example):

c:\fmw_12.\wls12213\oracle_common\common\bin>wlst.cmd d:\code\

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://myAdminServer:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "osb_domain".

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

Location changed to domainRuntime tree. This is a read-only tree
with DomainMBean as the root MBean.
For more help, use help('domainRuntime')

List of running servers in current domain:

End of script
Disconnected from weblogic server: AdminServer