WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How to count number of WebSphere Sessions?

    Posted Thu January 02, 2014 02:11 PM
    It is possible to create jython script to list active sessions connected to WebSphere Application Server?


  • 2.  How to count number of WebSphere Sessions?

    Posted Fri January 03, 2014 04:57 AM
    Hi denny,

      I suppose that you are talking about HTTP Sessions.
     
      The answer is yes you can do using PMI statics concretelly SessionManager MBean.  With WebModule or Servlet MBeans you can get more granular information

      PMI data organization
      pic.dhe.ibm.com/infocenter/wasinfo/v8r0/...

      Enabling PMI using the wsadmin tool
      pic.dhe.ibm.com/infocenter/wasinfo/v8r0/...
     
       
      an example (care with the indentation):
     
       servers = AdminTask.listServers( '[-serverType APPLICATION_SERVER]').splitlines()
       for server in servers:
        # Get server name
        newserver = server.split('(')
        # get the SessionManager mbean
        sm = AdminControl.queryNames ('WebSphere:type=SessionManager,process=' + newserver[0] + ',*')
        # now get the stats
        AdminControl.getAttribute(sm, 'stats')

       You can use PerfServletApp.ear too
       pic.dhe.ibm.com/infocenter/wasinfo/v8r0/...
       
       Look this thread   
       
       "user" connected to our systems?
       www.websphereusergroup.org/go/thread/vie...

      Hope this helps.
     
    regards


  • 3.  How to count number of WebSphere Sessions?

    Posted Thu January 23, 2014 10:58 AM
    Another way without having to write a script, is to use the enbedded Tivoli Performance Viewer.

    Not sure what version you are on, but the following is the navigation from the GUI console.

    Monitoring and Tuning --> Performance Viewer --> Current Activity --> SELECT YOUR APP SERVER --> Expand Performance Modules --> SELECT Servlet Session Manager and Select View Module. This should should you a LiveCount of HTTP Sessions for all your installed apps. 

    If you want to see it for a particular app (in case you have many installed) you can select just the app of interest under the Servlet Session Manager. 


  • 4.  How to count number of WebSphere Sessions?

    Posted Thu January 23, 2014 11:31 AM
    Sorry denny, just noticed your question was specifically around a jython script.


  • 5.  How to count number of WebSphere Sessions?

    Posted Tue January 28, 2014 12:16 PM
    You can save the below to a file called 'checkActiveSessions.py' and call via wsadmin.bat/sh.  Pass in the 'node name' and 'jvm name' as system arguements.
    ----------------------

    #USAGE:  
    ..."window.parent.tinyMCE.get('post_content').onLoad.dispatch();" contenteditable="true"># if executing from DMGR:  wsadmin.sh/bat -host dmgr_host -port dmgr_SOAP -lang jython -f checkActiveSessions.py nodeName appSrvName
     
    #nodeName = 'WASNode01'
    #appSrvName = 'server01'

    nodeName = sys.argv[0]
    appSrvName = sys.argv[1]

    perfStr = AdminControl.queryNames("type=Perf,process="+appSrvName+",node="+nodeName+",*")
    try:
        perfObj = AdminControl.makeObjectName( perfStr)
        srvrStr = AdminControl.queryNames("type=Server,name="+appSrvName+",node="+nodeName+",*")
        srvrObj = AdminControl.makeObjectName( srvrStr)
        type(perfObj)
        stats = AdminControl.invoke_jmx( perfObj, 'getStatsObject', [ srvrObj, java.lang.Boolean('true')], ['javax.management.ObjectName', 'java.lang.Boolean'])
        print stats.getStats('servletSessionsModule').getStatistic('ActiveCount')
        
    except:
        print '==== Server '+appSrvName+' is not running. ===='