
On 12.04.2012 09:21, RaSca wrote:
Hi everybody, I'm using the PHP API to make a web interface interact with the virtual machines installed on some hypervisor. Everything is fine, but I would like to find a way to get the guest's cpu and mem usage, so that it should be possible to make some rrd graphs. I didn't find out anything and also it seems looking around that there is no way to obtain those data.
What is strange for me is that programs like virt-top are showing exactly what I'm looking for. Can anyone help me to find out a way to retrieve those statistics?
Another related question: do you think I can obtain the same data by using this:
ps aux | egrep "[/]usr/libexec/qemu-kvm.*libvirt.*" | awk '{print $3"/"$4}'
This takes into account memory used by hypervisor itself. Either you need to extend libvirt-php; or you can do: $stats = exec("virsh dommemstat $dom"); However, I lean towards libvirt-php extension. Michal