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.

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")>

<cfset var memstats = servermonitorAPI.getJVMMemoryStats()> <cfset var jvmused = fix(memstats.usedmemory/1024/1024)> <cfset var jvmfree = fix(memstats.freememory/1024/1024)>

<cfset var total = jvmused+jvmfree> <cfset var freeperc = ceiling(jvmfree/total*100)> <cfset freeperc = round(freeperc/10)*10> <!---<cfset var usedperc = 100-freeperc>--->

<cfreturn freeperc/10>

</cffunction>

</cfcomponent>

Download attached file.