viewing sessions on your server across all applications
Have you ever wanted to know how many sessions are running on your server across ALL applications, then this code snippet should help. A big thanks to Russ AKA snake for helping on this
<html>
<head>
<title>session tracker</title>
</head>
<body>
<cfapplication name="">
<cfset request.overallTotal = 0 />
<cfloop collection="#application#" item="applicationName">
<cfscript>
sessiontrackerObj= createObject("java","coldfusion.runtime.SessionTracker");
activesessions = sessiontrackerObj.getSessionCollection('#applicationName#');
nosessions=ListLen(structkeyList(activeSessions));
</cfscript>
<cfif nosessions>
<cfoutput>
<h3>Total Sessions for #applicationName#: #nosessions#</h3>
</cfoutput>
<cfif structKeyExists(url,"showSessions")><cfdump var="#activesessions#"></cfif>
</cfif>
<cfset request.overallTotal = request.overallTotal + nosessions />
</cfloop>
<h3 style="position:absolute; top:0; right:0; width:200px;">OVERALL SESSIONS:
<cfoutput>#request.overallTotal#</cfoutput></h3>
</body>
</html>





DK
http://theofficenews.com