Wednesday, 20 December 2017

Checking the server health using WLST

connect('weblogic','weblogic','t3://localhost:7001')
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()
exit()


Running WLST in Online mode:
wls:/(offline)> connect('username','password', 't3://localhost:7001')
Connecting to weblogic server instance running at t3://localhost:7001 as username weblogic ...
Successfully connected to Admin Server 'myserver' that belongs to domain 'mydomain'.

wls:/mydomain/serverConfig>

Creating an script:

middleware_home=' /usr/weblogic/wlserver '
# Open a domain template.
readTemplate (middleware_home + '/common/templates/domains/wls.jar')
cd('Servers/AdminServer')
set('ListenPort', 7001 )
set('ListenAddress','192.168.10.1')
create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)
cd('/')
cd('Security/base_domain/User/WebLogic')
cmo.setName('WebLogic')
cmo.setPassword('secretPassword123 ')
setOption('OverwriteDomain', 'true')
setOption('ServerStartMode', 'prod')
writeDomain(domaintarget)
closeTemplate()



No comments:

Post a Comment