[libvirt] Is there a way to get host uptime in remote libvirt

coffeeball coffeeball at 163.com
Wed May 14 00:29:30 UTC 2014


We manage hypervisors (VMWare ESXi/vCenter, KVM, XEN, Hyper-V) by remote Libvirt API, in our case we need to get the host uptime via the same libvirt interface. Is there a way get this info now for all the aforementioned hypervisor types?

The APIs virConnectGetSysinfo(), virNodeGetInfo() provide host info but it doesn't include the system uptime.

The virNodeGetCPUStats() can returns CPU usage in nanosecond, can we add the user + system + idle + iowait to calculate the system uptime? Looks like the sum value has a huge gap with the real uptime value returned by "uptime" CLI.

virsh # nodecpustats
user:               2985046540000000
system:             1368209710000000
idle:             388018933920000000
iowait:               43371960000000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140514/565dc3aa/attachment-0001.htm>


More information about the libvir-list mailing list