2014. 8. 19. 14:34

JDBC Monitoring

JDBC Monitoring with LWLST script

One fine morning we (WLA support Team) got an assignment, The summary of the assignment was to find "How the WebLogic server instance performing for a DataSource?". WebLogic 9.x onwards a DataSource is associated with a ConnectionPool (a pool of connections to the DB). If we monitor ConnectionPool, inturn it is nothing but monitoring a DataSource.

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')//MBean에서 JDBCConnection 정보 가져옴
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()

'Weblogic' 카테고리의 다른 글

WebLogic Scripting Tool (WLST) Overview  (0) 2014.08.19
Server State using WLST  (0) 2014.08.19
weblogic coherence  (0) 2014.08.19
weblogic status check  (0) 2014.08.18
WebLogic StuckThreadMaxTime  (0) 2014.06.16
Posted by 아도니우스