Of-course the task is not that easy, I have gone through various WebLogic forums to find a appropriate solution for this task.
Oracle WebLogic provides two ways to Monitor a Datasource
1. Monitoring Datasource server wise
2. Testing the Connection Pool
Here I am publishing the same script which Madan Noru/Satya prepared in the old bea fourms or ObjectMix forums. Only one thing is difference is that displaying pattern, I had created a separate header, so that output looks good to see in a table form. To make this possible I have used C-Style print command from Python Language. This format you can change as per your screen display size.
The script will retrieve the JDBC Connection Pool MBean using adminHome, which is deprecated object in WLST. The output of the script will gives you the values of the following attributes:
- DataSource Name
- Maximum Capacity of the Connection Pool at Run-time
- Active Connections Current Count
- Active Connections High Count
- Wait Seconds High Count
- Waiting For Connection Current Count
- State of the Connection Pool
#=======================================================
# This script will monitor the JDBC CONNECTION POOL
# more details on this script contact: Pavan Devarkonda
#=======================================================
connect("username","passwd","t3://AdminIP:AdminPort")
try:
poolrtlist=adminHome.getMBeansByType('JDBCConnectionPoolRuntime')
print ' '
print ' '
print 'JDBC CONNECTION POOLS'
print ' '
print 'Name Max Active Active WaitSecs Waiting State'
print ' capacity Current HighCnt HighCnt Count'
for poolRT in poolrtlist:
pname = poolRT.getName()
pmaxcapacity = poolRT.getAttribute("MaxCapacity")
paccc = poolRT.getAttribute("ActiveConnectionsCurrentCount")
pachc = poolRT.getAttribute("ActiveConnectionsHighCount")
pwshc = poolRT.getAttribute("WaitSecondsHighCount")
pwfccc = poolRT.getAttribute("WaitingForConnectionCurrentCount")
pstate = poolRT.getAttribute("State")
print '%10s %7d %7d %7d %7d %7d %10s' % (pname,pmaxcapacity,paccc,pachc, pwshc,pwfccc,pstate)
print ' '
except:
print 'Error:'
dumpStack()
pass
disconnect()
Refernce Object Mix discussion:
http://objectmix.com/weblogic/549153-weblogic-monitoring-script-wlst-2.html
6 comments:
Hi Pavan..thnx for the script.
Can u Please add to this script on which server the jdbc is configured.
Suppose we have two managed servers.
Durai,
This script will work for two managed servers too. ServerName can be displayed when deployed jdbc service target compare and then you can display this monitoring output.
need to look into the MBean in deeper way and need to update. try your end too let me know if you get it. I will try... presently little busy in my work.
I like this script - it tells me essentially what I need at a glance regarding pools in our domain. However, I don't like that the pools are in a somewhat random order each time.
I would like to be able to alphabetically sort the JDBC connection pools but have been unable to find a sort routine that works in WLST.
@eldamir sort function you can call on list object. If you want sorted list first store in a list lets say 'poolList'. Then apply sort() on it
poolList.sort()
now you can go for display acttion...
Ref: http://wlstbyexamples.blogspot.com/2009/11/jms-monitoring-using-wlst.html
Thanks Pavan. This was very helpful.
You most welcome Viji
Post a Comment