Monday, March 10, 2014

WLST - JMS Monitoring

jmsmonitoring.py


connect('weblogic','welcome1','t3://localhost:7001')

allServers=domainRuntimeService.getServerRuntimes()

print "%s\t\t%s\t\t%s\t\t%s" % ("Name","Messages Current","Messages Pending","Messages Received")

for sname in allServers:
jmsS=sname.getJMSRuntime()
js=jmsS.getJMSServers()
for i in js:
print "\n%s\t\t%s\t\t%s\t\t%s" % (str(i.getName()),str(i.getMessagesCurrentCount()),str(i.getMessagesPendingCount()),str(i.getMessagesReceivedCount()))

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()