On the Admin tools there is a system performance page that we use to check the CPU utilization.
I am trying to create a monitor page and want to use that information to mark my server up or down from routing if the server's CPU is pegged.
Can I access that same info displayed on the admin tool with a java backed webscript?
Solved! Go to Solution.
The admin tool loads its data via a JSON-based web script that you can use for monitoring as well. See this blog post by Cesar Capillas for examples...
The admin tool loads its data via a JSON-based web script that you can use for monitoring as well. See this blog post by Cesar Capillas for examples...
Thanks Axel! I am using the following to get the info I need.
http://server:8080/alfresco/s/enterprise/admin/admin-performance?format=json
which returns JSON that I can use:
{
FreeMemory: 8478,
MaxMemory: 18432,
TotalMemory: 12288,
CPULoad: 25,
ThreadCount: 218,
PeakThreadCount: 225
}
Axel Faust, Cesar Capillas, Follow up question...
Is there a way to wire the Admin javascript object into a java backed webscript? I already have a java backed webscript I am using for my monitor.
Admin.getMBeanAttributes(
"java.lang:type=OperatingSystem",
["ProcessCpuLoad"]
);
Well, you wouldn't need to. All the data is freely accessible from a Java context without using the Admin JavaScript object. That is the reason why it was so simple for us to re-create the Enterprise Edition-only Support Tools for Community Edition (via the OOTBee Support Tools project). The JavaScript object is only wrapping that access code and exposes it to JavaScript...
Though the OOTBee Support Tools also uses JavaScript code, this basically just access the Java class java.lang.management.ManagementFactory to acecss the memory mbean to view memory metrics.
This worked like a charm. Thank you Axel Faust
OperatingSystemMXBean osBean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean()
monitorInfo.setCpuUtilization(osBean.processCpuLoad*100)
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.