使用wsadmin列出活动会话

时间:2012-06-13 14:30:32

标签: session websphere wsadmin

我正在尝试使用wsadmin编写一个脚本,该脚本将检索活动会话的总量。我环顾网络,没有发现任何真正有用的东西。有没有办法用wsadmin工具做到这一点?感谢。

1 个答案:

答案 0 :(得分:2)

请参阅内存会话计数中的Websphere - http://websphereadmin-janglestrategies.blogspot.com/2010/02/websphere-in-memory-session-count.html

从该博客文章

servers = AdminTask.listServers( '[-serverType APPLICATION_SERVER]').splitlines()

服务器中的服务器:

# 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')

希望你会得到这样的输出:

  

['','Stats name = My_WAR_FILE_NAME,type = servletSessionsModule','{',   'name = SessionObjectSize,ID = 18,description =平均大小   会话级别的会话对象,仅包括可序列化的对象   缓存中的属性。,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','}']