Weblogic WLST查询(同时列出已部署的应用程序和主机)
我有两个WLST问题。我通过WebLogic脚本工具控制台执行它。这些查询是: 1) 已部署应用程序的列表和状态:Weblogic WLST查询(同时列出已部署的应用程序和主机),weblogic,weblogic12c,weblogic11g,wlst,Weblogic,Weblogic12c,Weblogic11g,Wlst,我有两个WLST问题。我通过WebLogic脚本工具控制台执行它。这些查询是: 1) 已部署应用程序的列表和状态: connect('weblogic','password','t3://localhost:7001') cd('AppDeployments') deplymentsList=cmo.getAppDeployments() for app in deplymentsList: domainConfig() cd ('/AppDeployments/'+ap
connect('weblogic','password','t3://localhost:7001')
cd('AppDeployments')
deplymentsList=cmo.getAppDeployments()
for app in deplymentsList:
domainConfig()
cd ('/AppDeployments/'+app.getName()+'/Targets')
mytargets = ls(returnMap='true')
domainRuntime()
cd('AppRuntimeStateRuntime')
cd('AppRuntimeStateRuntime')
for targetinst in mytargets:
curstate4=cmo.getCurrentState(app.getName(),targetinst)
print app.getApplicationName(), targetinst, curstate4;
输出示例:
- WeblogicApp群集1状态\u活动
- DMS应用程序管理服务器状态\u活动
- 福利群集2状态为活动状态
connect('weblogic','password','t3://localhost:7001')
svrs = cmo.getServers()
domainRuntime()
for host in svrs:
machine = host.getMachine();
print "Host: " + machine.getName()
输出示例:
- 主机:192.168.200.1
- 主机:192.168.200.2
- 主机:192.168.200.3
- 主机:Machine-0
- 主持人:Machine-1
- 主持人:Machine-2
- WeblogicApp Cluster1状态为激活状态192.168.200.2
- WeblogicApp群集1状态为活动状态192.168.200.3
- DMS应用程序AdminServer状态_活动192.168.200.1
- DMS应用程序AdminServer状态\u活动机器-1
- DMS应用程序AdminServer状态\u活动机器-2
- 优势群集1状态\u活动机器-0
提前谢谢。晚会有点晚了。但如果有其他人来寻找答案,我会对第一个脚本进行扩展,以获得所需的结果:
connect('weblogic','password','t3://localhost:7001')
setShowLSResult(false)
cd('AppDeployments')
deplymentsList=cmo.getAppDeployments()
domainConfig()
for app in deplymentsList:
cd ('/AppDeployments/'+app.getName()+'/Targets')
mytargets = ls(returnMap='true')
for targetinst in mytargets:
domainRuntime()
cd('AppRuntimeStateRuntime')
cd('AppRuntimeStateRuntime')
curstate4 = cmo.getCurrentState(app.getName(),targetinst)
domainConfig()
cd('/AppDeployments/'+app.getName()+'/Targets/'+targetinst)
myType = cmo.getType()
if myType == 'Cluster':
myServers = cd('/AppDeployments/'+app.getName()+'/Targets/'+targetinst+'/Servers', returnMap='true')
for server in myServers:
cd('/AppDeployments/'+app.getName()+'/Targets/'+targetinst+'/Servers/'+server)
machineName = cmo.getMachine().getName()
print app.getApplicationName(), targetinst, curstate4, machineName
elif myType == 'Server':
cd('/AppDeployments/'+app.getName()+'/Targets/'+targetinst)
machineName = cmo.getMachine().getName()
print app.getApplicationName(), targetinst, curstate4, machineName
输出将与原始问题中所述的输出类似