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

Daniel P. Berrange berrange at redhat.com
Mon Jun 2 16:25:41 UTC 2014


On Wed, May 14, 2014 at 08:29:30AM +0800, coffeeball wrote:
> 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.

Afraid we don't have any reporting of the "uptime" yet - feel free to
report a bug against libvirt asking for this, or if you are C coder
we'd accept patches too.

> 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.

Yeah, I'm not sure that's going to be reliable.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list