← All posts

Session Counts using WLST

Three MBean attributes the admin console makes you click for

Unni Pillai
Unni Pillai

Someone asked me this question few days back:
Is there a way to find out the number of http sessions using WLST? I can query this information by clicking on Deployments and then clicking on Monitoring tab in Admin console.

Here’s the answer:

There is a MBEAN in the ‘RunTimeMbeans’ named ‘WebAppComponentRuntimeMBean’, which has these three attributes for retrieving session count related info:

OpenSessionsCurrentCount: Provides a count of the current total number of open sessions in this module.
SessionsOpenedTotalCount: Provides a count of the total number of sessions opened.
OpenSessionsHighCount: Provides the high water mark of the total number of open sessions in this server.This count starts at zero each time the server is activated.
-

Written by Unni on Sat 21 Feb 18:27 (IST) download

  1. # File Name : ‘SessionCount.py’

  2. # Set the enviroment using ‘setDomainEnv.cmd/sh’

  3. # Run the script using this command;

  4. # java weblogic.WLST SessionCount.py

  5. # Here - ‘inmemrep’ is the name of the app ; ‘AdminServer’ is the name of the server on which the app is deployed

  6. print ‘Start of script…’

  7. connect(‘weblogic’,‘weblogic’,‘t3://localhost:7001’)

  8. serverRuntime()

  9. cd(‘/ApplicationRuntimes/inmemrep/ComponentRuntimes/AdminServer_/inmemrep’)

  10. n = get(‘Name’)

  11. x = get(‘OpenSessionsHighCount’)

  12. y = get(‘OpenSessionsCurrentCount’)

  13. z = get(‘SessionsOpenedTotalCount’)

  14. print ‘Session Counts for ‘,n

  15. print\n------------’

  16. print\nOpenSessionsHighCount: ‘,x

  17. print\nOpenSessionsCurrentCount: ‘,y

  18. print\nSessionsOpenedTotalCount: ‘,z

  19. print ‘End of script…’

  20. # Code written by:

  21. # Unnikrishnan Pillai,

  22. # Engineer,

  23. # Oracle Global Support

Signing off…

Unni

unni@unnikrishnanpillai.tk