ColdFusion Monitoring in Standard Edition

Feb 17, 2010

So up until now you could only call on the ColdFusion Monitoring Service if you where running an Enterprise license. Even if you made an adminapi call to the servermonitoring.cfc component, it also required an enterprise license to run properly. However, all of this is only partly true. There is a way to get some information from the underlining server monitoring even in standard editions.

So everything is still running through the Service Factory which you can call through createObject(). Back before the adminapi, people were doing Service Factory calls to do basic server management. Thankfully, the service factory is still there and it does list a getMonitoringService() method.

<cfset ms = createObject("java","coldfusion.server.ServiceFactory").getMonitoringService()/>
<cfdump var="#ms#"/>

Now in standard edition, you will notice that this call actually gets redirected to a feature router object which essentially overrides the basic methods to actually start and run the monitoring, profiling, etc., but it doesn't override everything. There are still things you can call and get vital information about the server. For example..

You can call the HeartBeat method to see how many active requests are running or how much memory is currently being used.

<cfdump var="#ms.getHeartBeat()#"/>

Or call the Garbage Collector

<cfset ms.callGC()/>

Or get an array of the templates that resulted in an error and their respective error counts.

<cfdump var="#ms.getRequestWithErrors()#"/>

Or get an array of the templates that timed out and their respective time-out counts.

<cfdump var="#ms.getTimedOutRequests()#"/>

To get a full list of features, just look at the parent class of the object call. It's called "coldfusion.monitor.MonitoringServiceImpl".

There's actually a lot there. I wish Adobe would simply open this in the first place, but for now this may be quite handy for some. I did try to directly call the "coldfusion.monitor.MonitoringServiceImpl" object but ran into various errors trying to use it. Perhaps someone smarter than me can make it work.


charlie arehart

charlie arehart wrote on 05/05/106:03 PM

That's just awesome, John. Thanks so much for sharing it.

Write your comment

(it will not be displayed)