Getting ColdFusion Server Metrics
December 16, 2003
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.
Tweet
Trackbacks
Trackback Address: 101/72CAF3EE48D701C6CBB81BD0123674AF
Comments
On 01/18/2004 at 12:10:59 PM EST Brian wrote:
1
Interesting, running this on a CF5 server seems to restart the CF service. Any idea why?
On 01/21/2004 at 1:40:57 AM EST Pete Freitag wrote:
2
No idea, that should work on a CF5 server as well.
On 02/18/2004 at 3:40:53 PM EST Matt wrote:
3
Will the GetMetricData() work on the J2EE version of MX?
On 03/28/2006 at 12:05:02 PM EST Ross wrote:
4
This will work on J2EE servers, but you must initialize metrics in J2EE. See here: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_19120
On 05/05/2006 at 9:31:42 AM EDT Scott wrote:
5
Observation: On my CF5 server, it's the GetMetricData("SIMPLE_LOAD") line that seems to make the service hiccup. The other two lines ("PREV_REQ_TIME" and "AVG_REQ_TIME") work fine.
On 10/19/2009 at 3:55:43 PM EDT Craig M. Rosenblum wrote:
6
Does this work on cf 8 standard?
On 10/19/2009 at 5:15:37 PM EDT Pete Freitag wrote:
7
@Craig - Yes it does work on CF 8 Standard.
Post a Comment
Recent Entries
- Nginx redirect www to non www domain
- HashDOS and ColdFusion
- HackMyCF Updated for APSB11-29 Security Hotfix
- Adobe eSeminar on FuseGuard
- Determining Which Cumulative Hotfixes are Installed on ColdFusion
- Adding Two Factor Authentication to ColdFusion Administrator
- ColdFusion Developer Week at Adobe.com
- Bug Loading Scripts for CFFileUpload and CFMediaPlayer


add to del.icio.us



