Getting ColdFusion Server Metrics
The often forgoten function GetMetricData()
function returns the same info as the cfstat
utility. Here's an example:
<cfset metrics = GetMetricData("PERF_MONITOR")> <cfoutput> ColdFusion Server Metrics: <br> <br> InstanceName: #metrics.InstanceName# <br> PageHits: #metrics.PageHits# <br> ReqQueued: #metrics.ReqQueued# <br> DBHits: #metrics.DBHits# <br> ReqRunning: #metrics.ReqRunning# <br> ReqTimedOut: #metrics.ReqTimedOut# <br> BytesIn: #metrics.BytesIn# <br> BytesOut: #metrics.BytesOut# <br> AvgQueueTime: #metrics.AvgQueueTime# <br> AvgReqTime: #metrics.AvgReqTime# <br> AvgDBTime: #metrics.AvgDBTime# <br> CachePops: #metrics.CachePops# <br> Simple Load: #GetMetricData("SIMPLE_LOAD")#<br> Prev Request Time: #GetMetricData("PREV_REQ_TIME")#ms<br> Avg Request Time: #GetMetricData("AVG_REQ_TIME")#ms<br> </cfoutput>
I had always thought it would be interesting to write a scheduled task to record these values in a database, and then generate reports.
Like this? Follow me ↯
Tweet Follow @pfreitagGetting ColdFusion Server Metrics was first published on December 16, 2003.
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.
Comments
Interesting, running this on a CF5 server seems to restart the CF service. Any idea why?
by Brian on 01/18/2004 at 10:10:59 AM UTC
No idea, that should work on a CF5 server as well.
by Pete Freitag on 01/20/2004 at 11:40:57 PM UTC
Will the GetMetricData() work on the J2EE version of MX?
by Matt on 02/18/2004 at 1:40:53 PM UTC
Does this work on cf 8 standard?
by Craig M. Rosenblum on 10/19/2009 at 1:55:43 PM UTC
@Craig - Yes it does work on CF 8 Standard.
by Pete Freitag on 10/19/2009 at 3:15:37 PM UTC