Monitor your ColdFusion server... Zelda style

Last week I had the idea that it might be kind of cool to port the CFAM project to the Blackberry Playbook. While that would be a lot of work (technically it wouldn’t be if we just used a web view, but I’m talking about a proper conversion to Flex), I had the idea of a somewhat… simpler way to monitor ColdFusion on a mobile device - in this case my droid. To be honest, only video would do this justice.

</param></param></param></embed>

I’ve included the source code for the project below. The CFC that returns the RAM usage is simple enough to just print below.

<cfcomponent>

<cffunction name=”getHealth” access=”remote” returnType=”numeric” output=”false”> <cfset var adminAPI = createObject(“component”, “CFIDE.adminapi.administrator”)> <cfset var servermonitorAPI = createObject(“component”, “CFIDE.adminapi.servermonitoring”)> <cfset adminAPI.login(“admin”, “admin”)>

&lt;cfset var memstats = servermonitorAPI.getJVMMemoryStats()&gt;
&lt;cfset var jvmused = fix(memstats.usedmemory/1024/1024)&gt;
&lt;cfset var jvmfree = fix(memstats.freememory/1024/1024)&gt;

&lt;cfset var total = jvmused+jvmfree&gt;
&lt;cfset var freeperc = ceiling(jvmfree/total*100)&gt;
&lt;cfset freeperc = round(freeperc/10)*10&gt;
&lt;!---&lt;cfset var usedperc = 100-freeperc&gt;---&gt;

&lt;cfreturn freeperc/10&gt;

</cffunction>

</cfcomponent> </code>

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments