08-16-2017 04:32 AM
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?
08-16-2017 06:36 AM
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...
08-16-2017 06:36 AM
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...
08-16-2017 08:59 AM
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
}
08-17-2017 11:21 AM
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"]
);
08-17-2017 01:37 PM
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.
08-28-2017 09:58 AM
This worked like a charm. Thank you Axel Faust
OperatingSystemMXBean osBean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean()
monitorInfo.setCpuUtilization(osBean.processCpuLoad*100)
Explore our Alfresco products with the links below. Use labels to filter content by product module.