Use the Server Monitor API to programmatically retrieve all of the data that the Server Monitor collects. The servermonitoring.cfc ColdFusion component contains methods that you call to perform Server Monitor tasks. For example, use the getAverageResponseTime method to get the average response time for the server.
To view the methods, method arguments, and documentation for the Server Monitor API, use the CFC Explorer. To do so, go to http://localhost:8500/CFIDE/adminapi/servermonitoring.cfc.
The following example uses the Server Monitor API to list the data sources to which the ColdFusion Server is connected:
<cfscript> // Login to the ColdFusion Administrator. adminObj = createObject("component","cfide.adminapi.administrator"); adminObj.login("admin"); // Instantiate the Server Monitor object. myObj = createObject("component","cfide.adminapi.servermonitoring"); // Get the average response time myObj.getDbPoolStats(); </cfscript> <!--- Copy the array. ---> <cfset copyofarray = ArrayNew(1)> <cfset copyofarray = #myObj.getDbPoolStats()#> <!--- Get the length of the array. ---> <cfset dbpoolarraylen = ArrayLen(copyofarray)> <!--- List the data sources. ---> The ColdFusion server is connected to the following data sources:<BR /> <cfset i = 1> <cfloop index="i" from="1" to="#dbpoolarraylen#"> <cfoutput>#copyofarray[i].DSN#<br /></cfoutput> </cfloop>