Session Counts using WLST
Three MBean attributes the admin console makes you click for
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
-
# File Name : ‘SessionCount.py’
-
# Set the enviroment using ‘setDomainEnv.cmd/sh’
-
# Run the script using this command;
-
# java weblogic.WLST SessionCount.py
-
# Here - ‘inmemrep’ is the name of the app ; ‘AdminServer’ is the name of the server on which the app is deployed
-
print ‘Start of script…’
-
connect(‘weblogic’,‘weblogic’,‘t3://localhost:7001’)
-
serverRuntime()
-
cd(‘/ApplicationRuntimes/inmemrep/ComponentRuntimes/AdminServer_/inmemrep’)
-
n = get(‘Name’)
-
x = get(‘OpenSessionsHighCount’)
-
y = get(‘OpenSessionsCurrentCount’)
-
z = get(‘SessionsOpenedTotalCount’)
-
print ‘Session Counts for ‘,n
-
print ‘\n------------’
-
print ‘\nOpenSessionsHighCount: ‘,x
-
print ‘\nOpenSessionsCurrentCount: ‘,y
-
print ‘\nSessionsOpenedTotalCount: ‘,z
-
print ‘End of script…’
-
# Code written by:
-
# Unnikrishnan Pillai,
-
# Engineer,
-
# Oracle Global Support
Signing off…
Unni