<div dir="ltr">Great!<br><br>I have Xen hypervisor. Can I can memory information from "domain 0" instance as well.  How to get physical utilization of each CPU attached  to host? I know this is being handled in virt-top but how?<br>
<br>- Jovial<br><br><div class="gmail_quote">On Mon, Sep 1, 2008 at 5:04 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Mon, Sep 01, 2008 at 04:54:04PM +0200, jovialGuy _ wrote:<br>
> I am unable to find the api in java and perl binding to find the host node's<br>
> current memory and cpu information. Any body has any idea where I can find<br>
> the information?<br>
<br>
</div></div>I'm not certain about whether the Java & Perl bindings support them,<br>
but these are the calls you should use:<br>
<br>
<a href="http://libvirt.org/html/libvirt-libvirt.html#virNodeGetInfo" target="_blank">http://libvirt.org/html/libvirt-libvirt.html#virNodeGetInfo</a><br>
<a href="http://libvirt.org/html/libvirt-libvirt.html#virNodeGetCellsFreeMemory" target="_blank">http://libvirt.org/html/libvirt-libvirt.html#virNodeGetCellsFreeMemory</a><br>
<a href="http://libvirt.org/html/libvirt-libvirt.html#virNodeGetFreeMemory" target="_blank">http://libvirt.org/html/libvirt-libvirt.html#virNodeGetFreeMemory</a><br>
<br>
For CPU usage of the host, libvirt doesn't specifically provide that<br>
information.  If the hypervisor is Xen, then you can get information<br>
about CPU usage of Dom0 (usually what is meant by "the host") using:<br>
<br>
<a href="http://libvirt.org/html/libvirt-libvirt.html#virDomainGetInfo" target="_blank">http://libvirt.org/html/libvirt-libvirt.html#virDomainGetInfo</a><br>
<br>
but that won't work for QEMU/KVM where "the host node" is just the<br>
Linux kernel.  (In the local case, you can extract that information<br>
you need just by looking in /proc or using ordinary Linux tools).<br>
<br>
Also read this: <a href="http://et.redhat.com/%7Erjones/virt-top/faq.html#calccpu" target="_blank">http://et.redhat.com/~rjones/virt-top/faq.html#calccpu</a><br>
<br>
Rich.<br>
<font color="#888888"><br>
--<br>
Richard Jones, Emerging Technologies, Red Hat  <a href="http://et.redhat.com/%7Erjonesvirt-top" target="_blank">http://et.redhat.com/~rjones<br>
virt-top</a> is 'top' for virtual machines.  Tiny program with many<br>
powerful monitoring features, net stats, disk stats, logging, etc.<br>
<a href="http://et.redhat.com/%7Erjones/virt-top" target="_blank">http://et.redhat.com/~rjones/virt-top</a><br>
</font></blockquote></div><br></div>