Tuesday, February 5, 2013

Oracle SOA 11.1.1.6: WLST Scripts to Monitor Data Sources


This BLOG thread details the steps involved in creating WLST scripts to help to monitor the Data Sources on Weblogic Server with Admin Server or SOA  Server targets.

The scripts take advantage of a properties file which includes the server information. A file  CheckDataSourcesState.properties


userName=weblogic
passWord=password
wlsHost=localhost
adminServerListenPort=8001
dataSourcesToBeChecked=DataSourceDS1,DataSourceDS2



The WLST script can be created in an another file CheckDataSourcesState.py


import os
propInputStream = FileInputStream("CheckDataSourcesState.properties")
configProps = Properties()
configProps.load(propInputStream)
connect(configProps.get("userName"),configProps.get("passWord"),'t3://'+configProps.get("wlsHost")+':'+configProps.get("adminServerListenPort"))
serverRuntime()
dsMBeans = cmo.getJDBCServiceRuntime().getJDBCDataSourceRuntimeMBeans()
splits=String(configProps.get("dataSourcesToBeChecked")).split(",")
for ds in dsMBeans:
    for splitDSName in splits:
        if (splitDSName == ds.getName()):
              print 'DS name is: '+ds.getName()
              print 'State is ' +ds.getState()
              print ds.testPool()

OCI Knowledge Series: OCI Infrastructure components

  Oracle Cloud Infrastructure (OCI) provides a comprehensive set of infrastructure services that enable you to build and run a wide range of...