Site icon

WLST – List server status in weblogic domain (python script/example)

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

def serversRunningStatus():

    #Get list of servers in current domain
    servers = cmo.getServers()
    print "Server status in current domain: "
    for server in servers:
        #Get State of each server
        state(server.getName(),server.getType())
    print "End of script"

connect("weblogic","welcome2","myAdminServer:7001")

serversRunningStatus()
disconnect()

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

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

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.

Server status in current domain:
Current state of "AdminServer" : RUNNING
Current state of "st_server1" : SHUTDOWN
Current state of "st_server2" : SHUTDOWN
Current state of "st_server3" : RUNNING
Current state of "st_server4" : RUNNING
End of script
Disconnected from weblogic server: AdminServer
Exit mobile version