Hi Guys,
Today I wrote a WLST code to get the name and the status of the applications running in the weblogic domain. I have used a properties file for the input of various parameters such as middleware home and WebLogic home etc... Please modify the credentials and urls before proceeding further. Here are the codes as given below:
- Properties file (rename to auth.properties)
username=weblogic
password=welcome1
#This is Admin Server URL
url=t3://mars:7001
#This is Middleware Home
MW_HOME=/mnt/vol_ora_SOADEV1_apps_01/FMW_HOME/
#This is WebLogic Home
WL_HOME=$MW_HOME/wlserver_10.3/
#This is where wlst.sh resides
WLST_HOME=$WL_HOME/server/bin
- WLST Script:
import java.lang
import os
import string
import sys
propInputStream = FileInputStream("/home/oracle/scripts/properties/auth.properties")
configProps = Properties()
configProps.load(propInputStream)
ServerUrl = configProps.get("url")
UserName = configProps.get("username")
Password = configProps.get("password")
connect(UserName,Password,ServerUrl)
domainRuntime()
cd('AppRuntimeStateRuntime/AppRuntimeStateRuntime')
AppList = cmo.getApplicationIds()
file1=open('ApplicationStatus.csv','w+')
print>>file1, " Application Name ", ",", " Application Status "
for App in AppList:
AN = App
AS = cmo.getIntendedState(App)
print>>file1,AN, ",", AS
print "values have been captured successfully into the csv file"
file1.close()
So you will get an output like below screenshot:
I hope it is useful.
-G
0 comments