I'm trying to write a script with wsadmin that will retrieve the total amount of active sessions. I've looked around the web and haven't found anything really helpful. Is there a way to do this with the wsadmin tool? Thanks.
Asked
Active
Viewed 5,201 times
2
-
active http sessions to your webapp/servlet? or something else? – Davanum Srinivas - dims Jun 13 '12 at 14:42
1 Answers
2
See Websphere in memory session count - http://websphereadmin-janglestrategies.blogspot.com/2010/02/websphere-in-memory-session-count.html
From that blog post
servers = AdminTask.listServers( '[-serverType APPLICATION_SERVER]').splitlines()
for server in servers:
# Now just get the app server name - not the whole jython config id
newserver = server.split('(')
# get the session manager mbean
ps = AdminControl.queryNames ('WebSphere:type=SessionManager,process=' + newserver[0] + ',*')
# now get the stats for the mbean
AdminControl.getAttribute(ps, 'stats')
And hopefully you will get some output like this:
['', 'Stats name=My_WAR_FILE_NAME, type=servletSessionsModule', '{', 'name=SessionObjectSize, ID=18, description=The average size of the session objects at session level, including only serializable attributes in the cache., unit=BYTE, type=AverageStatistic, avg=1762.5, min=1713, max=1812, total=200925, count=114, sumSq=4.0370855625E10, type=TimeStatistic, avg=1762.5, min=1713, max=1812, total=200925, count=114, sumSq=4.0370855625E10', '}']

slm
- 15,396
- 12
- 109
- 124

Davanum Srinivas - dims
- 889
- 6
- 8
-
This looks like it might work. I will give it a go and report back. Thanks! – Ryan Schulze Jun 13 '12 at 15:11