[]$ cat runWeblogicWLST.sh ##脚本
. /opt/bea/user_projects/domains/base_domain/bin/setDomainEnv.sh
cd
cd dir
/opt/jdk1.5.0_16/bin/java weblogic.WLST weblogicinfo.py
如下为weblogicinfo.py 脚本:
from java.util import *
from javax.management import *
import javax.management.Attribute
for i in (1,2,3,4):
if i == 1:
connect('','','t3://:7001')
elif i == 2:
connect('','','t3://:7001')
elif i == 3:
connect('','','t3://:7001')
else:
connect('','','t3://:7001')
domainConfig()
appss = cmo.getAppDeployments()
for appname in appss:
cd('../../../../../../../../../../../../')
appnameone = appname.getName()
print appnameone
cd('AppDeployments')
cd(appname.getName())
Target = cmo.getTargets()
cd('Targets')
for Targetone in Target:
print ' '+Targetone.getName()
cd(Targetone.getName())
if cmo.getType() == 'Server':
print" ",;print cmo.getListenAddress(),;print":",;print cmo.getListenPort()
domainRuntime()
cd('AppRuntimeStateRuntime')
cd('AppRuntimeStateRuntime')
print cmo.getCurrentState(appnameone,Targetone.getName()),
cd('../')
cd('../')
domainConfig()
break
else:
cd('Servers')
servers = cmo.getServers()
for servero in servers:
print ' '+servero.getName(),;print" ",
cd(servero.getName())
print cmo.getListenAddress(),;print":",;print cmo.getListenPort(),
cd('../')
domainRuntime()
cd('AppRuntimeStateRuntime')
cd('AppRuntimeStateRuntime')
print cmo.getCurrentState(appnameone,servero.getName()),
cd('../')
cd('../')
domainConfig()
cd('../')
WLST:
wls:/testonly/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> cmo.getCurrentState('app#v2','ms1')
wls:/zdxtestonly/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> cmo.getCurrentState('app#v2','ms12')
'STATE_RETIRED'
wls:/zdxtestonly/domainRuntime/AppRuntimeStateRuntime/AppRuntimeStateRuntime> cmo.getApplicationIds()
array(['app#v2', 'app#v1'], java.lang.String)
脚本取所有应用在所有节点的状态需要程序取array(['app#v2', 'app#v1'], java.lang.String) 里面的应用,然后去每个应用在的节点,然后执行
类似
cmo.getCurrentState('app#v2','ms12')
阅读(725) | 评论(0) | 转发(0) |