Вопрос

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.

Это было полезно?

Решение

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', '}']

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top