Search code examples
javajmx

How to get Network I/O and Disk I/O through JMX


I have been working on to get system mertics like CPU, Memory, Network I/O, Disk I/O using JMX.

  • For CPU i have used function OperatingSystemMXBean.getSystemLoadAverage() and got the load of CPU.

  • For Memory i have used functions OperatingSystemMXBean.getTotalPhysicalMemorySize() and OperatingSystemMXBean.getFreePhysicalMemorySize().

Is there any function to get Network I/O and Disk I/O through JMX?


Solution

  • Most VMs (all?) do not expose that data. You would need to use a library like sigar (source is at github), that can gather those values and then expose the return values of sigar via JMX.

    We are using sigar with success in http://rhq-project.org/