Hi All,

 

I would like to know if there is a way to fetch the “CPU Usage and Memory Usage for VM “  and CPU Usage and Memory Usage for a Host in the KVM environment using libvirt java sdk .

I am using libvirt-0.5.1.jar.

This is the maximum Information I could fetch using the libvirt java API.:


vmname:flow-cluster1

state:VIR_DOMAIN_RUNNING

ostype:hvm

guest id :8f0b96e5-1e08-40ce-aea1-9985d80fcabb

Max memory : 8388608

Max cpus : 4

Guest Info-cputime: 58930890000000

Guest Info-maxMem: 8388608

Guest Info-memory: 8388608

Guest Info-nrVirtCpu: 4

MemoryStatistic: 8388608

Autostart :false


I tried looking into the libvirt java sdk but did not find any methods to fetch the exact  CPU Usage percentage and Memory Usage percentage for a VM and Host.

 

Can you please provide me with the java example if possible.

 

Thanks,

Prashanth R