[Looking for Charlie's main web site?]

Tracking ColdFusion sessions within FusionReactor, by way of FREC logging

Note: This blog post is from 2013. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Someone asked on the FusionReactor mailing list (a Google Group) whether FusionReactor tracked CF sessions. I started to write a reply, with the good news/bad news in answer to that, and as sometimes happens, it became long enough that I thought it might be better suited as a blog entry that I could point to from the list instead, and which may also help those not on the list (which is a great resource, as a low-volume list with a high signal to noise ratio.)

Anyway, here is the answer I wanted to offer to that question...

[....Continue Reading....]

Comments
In FR5 (from update 5.0.6) we added support for graphing the ColdFusion Active Session Count if you go into Metrics->Custom Series you should see /ColdFusionServerMonitor/ACTIVESESSIONCOUNT as one of the custom graphs. The data is coming from the ColdFusion Server Monitoring API via FREC which is integrated into FR5 by default.
# Posted By Darren | 10/15/13 12:07 PM
Excellent news, Darren. Thanks for pointing that out.
Darren, is there a documentation on how "ColdFusion Server Monitoring API" works to populate this chart?!
# Posted By Paolo | 12/11/13 8:30 AM
I'm don't think there is any on how it works. Just the documentation of the CF Server Monitoring API itself.
# Posted By Darren | 12/11/13 8:34 AM
Thanks Darren,
but which API is called -> "cfide.adminapi.servermonitoring.getActiveSessionCount()" ?
# Posted By Paolo | 12/11/13 10:22 AM
Paolo, got it... yes it is getActiveSessionCount.
# Posted By Darren | 12/11/13 10:33 AM
You can add a metric series to FusionReactor using FRAPI. Basically your code posts metric values into FR and these will be added to the custom series.

Here is another example using the ColdFusion Server Monitor API to track memory:
<cfscript>
frapi = createObject("java", "com.intergral.fusionreactor.api.FRAPI").getInstance();
adminObj = createObject("component","cfide.adminapi.administrator").login("passwordhere");
srvMon = createObject("component","cfide.adminapi.servermonitoring");
</cfscript>

<cfobject type="java" action="create" class="java.lang.Thread" name="Thread">

<cfloop from=1 to=120 index="j">
<cfscript>

frapi.postNumericAggregateMetric("/CF/MemoryUsage",
srvMon.getRealtimeStats().JVMUSEDMEMORY / 1048576 );

WriteOutput( srvMon.getRealtimeStats().JVMUSEDMEMORY / 1048576 );

Thread.sleep( JavaCast( "long",1000 ) );

</cfscript>
<cfflush>
</cfloop>


Here is an example where you are adding a series called Revenue (doesn't have to be a technical series :-) ). Notice I've just put these into loops with delays because they don't run in a sampler. Typically you would embed them into your code when you have a metric to track. Currently we only show the average of the series if you post multiple values inside the same second.

<cfscript>
frapi = createObject("java", "com.intergral.fusionreactor.api.FRAPI").getInstance();
</cfscript>

<cfobject type="java" action="create" class="java.lang.Thread" name="Thread">

<cfloop from=1 to=120 index="j">
<cfscript>
frapi.postNumericAggregateMetric("/Website/Revenue", RandRange(100,300));
Thread.sleep( JavaCast( "long",1000 ) );
</cfscript>
<cfflush>
</cfloop>



I'm not sure what the unknown series is, can you provide me with a little more information?
# Posted By Darren | 12/12/13 6:50 AM
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting