I have two WLST queries. I execute it through WebLogic Scripting Tool console. These queries are:
1) List of deployed applications and status:
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;
Output example:
- WeblogicApp Cluster1 STATE_ACTIVE
- DMS Application AdminServer STATE_ACTIVE
- Benefits Cluster2 STATE_ACTIVE
2) List of hosts-machines
connect('weblogic','password','t3://localhost:7001')
svrs = cmo.getServers()
domainRuntime()
for host in svrs:
machine = host.getMachine();
print "Host: " + machine.getName()
Output example:
- Host: 192.168.200.1
- Host: 192.168.200.2
- Host: 192.168.200.3
- Host: Machine-0
- Host: Machine-1
- Host: Machine-2
I need to get both info (an application and their host or shared hosts if they have it more than one). I don't know how to solve and mix the queries to get both info in one query, or at least to get the info related about deployment application - hosts in the second query.
The output needed is something like that:
- WeblogicApp Cluster1 STATE_ACTIVE 192.168.200.2
- WeblogicApp Cluster1 STATE_ACTIVE 192.168.200.3
- DMS Application AdminServer STATE_ACTIVE 192.168.200.1
- DMS Application AdminServer STATE_ACTIVE Machine-1
- DMS Application AdminServer STATE_ACTIVE Machine-2
- Benefits Cluster1 STATE_ACTIVE Machine-0
- ..............
Thanks in advance.