Read CPU and memory Usage of whole system (not JVM)

I’d like to monitor the CPU and memory usage of the whole system and not just the JVM.
Thanks for any help or source code.

Something like this should work, though it’s not guaranteed to work on every JVM:

>>> from import ManagementFactory
>>> bean = ManagementFactory.getOperatingSystemMXBean()
>>> print bean.getSystemCpuLoad() * 100.0

It relies on the returned bean being a The interface does not include getSystemCpuLoad.

I check but it doesn’t work it seems it only return JVM CPU usage.

I find some code but I cant make it work in igniton. Could you please help me on that.


OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
# What % CPU load this current JVM is taking, from 0.0-1.0
print osBean.getProcessCpuLoad()

# What % load the overall system is at, from 0.0-1.0

The code I posted is the same thing but already converted to Jython and should work in Ignition…

1 Like