On 07/03/2014 01:12 AM, Restituto Marcus Arevalo wrote:
Greetings everyone,
[can you convince your mailer to wrap long lines?]
I just want to ask if it is possible to get the CPU usage of
the VMs in KVM
through libvirt? I mean, how does the virt-manager
produce the graph it displays? Is there a way get this graph? But
instead of the graph itself, I just need to get it in percentage(%)
form. I'd like to know how. Thank you and your help will be greatly
appreciated.
The beauty of open source: pop open an editor on the virt-manager source
code and learn for yourself how it is computing the graph.
The trick is to call the query function at a regular interval
(virDomainGetCPUStats in C code, or the appropriate language bindings in
whatever you are doing), then manually subtract the difference in values
between successive calls to compute a percentage yourself.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org