Friday, March 7, 2014

WLST - Data Source Monitoring

dsmonitory.py

hostName='localhost'
userName='weblogic'
passWord='welcome1'

connect(userName,passWord,'t3://localhost:8081')

print "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % ("Name","State","JNDI","ActiveConnCurrCount","ActiveConnHighCount","CurrCap","CurrCapHighCount","Driver")
#Get all server names
allServers=domainRuntimeService.getServerRuntimes()

#Get DS state
for sname in allServers:
    js=sname.getJDBCServiceRuntime()

ds=js.getJDBCDataSourceRuntimeMBeans()

for dsname in ds:
    print  dsname.getName(),dsname.getState(), \        
    dsname.getActiveConnectionsCurrentCount(), \
    dsname.getCurrCapacity(), dsname.getConnectionsTotalCount()
    state=dsname.getState()
    if state != 'Running':
        print 'Data Source ' + str(ds.getName()) + ' not running. Current state is: ' + state

disconnect()

No comments:

Post a Comment