Redirect Weblogic Application Status in .CSV file


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)
#this is global variable and DO NOT CHANGE ANY VARIABLE HERE
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:
from java.io import FileInputStream
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
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© Ganesh Sairam's Oracle Blog
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top