Wednesday, July 12, 2017

Get connection pool usage in WebSphere

./wsadmin.sh -f test.jy -lang jython -port 8879 >> log.txt

Contents of test.jy will be

objectName=AdminControl.queryNames("*:type=DataSource,*")
templateArray=objectName.split('\n')
for object in templateArray: print AdminControl.invoke(object,'showPoolContents')

Now log.txt will contain the connection pool information for all the datasources.

This may be very useful when you want to know the connection pool usage of datasources.

 Usually , you will have security enabled  in your environment. In those cases, give the username and password fields as below.

 ./wsadmin.sh -f test.jy -lang jython -port 8879 -username admin -password password >> log.txt

 Otherwise  , you may keep checking the log.txt to see for any prompts . If there is any prompt for certificate acceptance or username, password.
Then you give the values accordingly on the prompt and connection pool datasource log will be generated after that.