[libvirt-users] How i can calculate cpu utilization percentage for host using python libvirt API.

deepak at fluentsoft.com deepak at fluentsoft.com
Fri May 23 07:16:44 UTC 2014


 

 

Hi,

How i can calculate cpu utilization percentage for host using python
libvirt API.
Which function can i use for calulating cpu percentage of host and Virtual
Machines?

1)Host cpu utilization
 ====================
 I tried getCPUStats() function,it gives the following output.Is there any
way to calculate cpu percentage from the following output?
 Is there any other function availabe for calculating cpu utilization
percentage? 
 
 output:{'kernel': 34870000000L, 'idle': 3522190000000L, 'user':
209930000000L, 'iowait': 132240000000L}

 import libvirt
 conn=libvirt.open('qemu+ssh://root@192.168.1.4/system')
 conn.getCPUStats(-1,0)

 

 

Thanks and Regards,
Deepak S

-------------------------
Message sent via Atmail Open - http://atmail.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140523/67760ae2/attachment.htm>


More information about the libvirt-users mailing list