We run a mixed bag of Citrix XenServer and Gentoo/Xen virtualization platforms in our company. In general, we use XenServer where we have shared storage (SAN, iSCSI or whatever) and Gentoo/Xen where we want to use local storage.

With XenServer, we can get detailed utilization statistics for both the Dom0 and the various DomUs on the platform. We also monitor the DomUs via SNMP (Cacti). We can get stats from the Gentoo/Xen DomUs using SNMP or SAR or whatever else, but we aren't able to get good usage stats from the Dom0. Without this, we're not able to assess how effectively we're using the hardware and when we need to look at building out.

I'm sure this must be a solved problem, but my Google-Fu has let me down somewhat, so I'm hoping someone here might have some ideas.



  • You want stats from the hypervisor, not dom0, right? Or am I missing something? – Thomas Jul 26 '09 at 19:48

Your questions is a little unclear as to what kind of stats you are hoping to collect from the dom0, but I think what you are looking for is an understanding of how your existing hardware resources are allocated.

We're having great success using libvirt's Python bindings to get this information. Here's a Python script snippet that illustrates the idea:

#!/usr/bin/env python

import sys
import libvirt

def main(options,args):
    hypervisors = sys.argv[1:]

    print "%16s%18s%18s%18s" % ("dom0 IP", "Free Memory (MB)", "Disk Used (GB)", "Disk Free (GB)")
    for ip in hypervisors:
        # this assumes "remote" connection to libvirtd using TCP
        url = "xen+tcp://%s" % (ip)

        conn = libvirt.open(url)
        # you may want to do more error handling here
        if conn == None:

        mem = conn.getFreeMemory() / 1048576 #convert bytes -> megabytes
        pool = conn.storagePoolLookupByName('vol0')
        # a refresh() is necessary because libvirtd's internal information isn't
        # always in sync with the host.
        disk_info = pool.info()
        disk_used = disk_info[2] / 1073741824 #convert bytes -> gigabytes
        disk_free = disk_info[3] / 1073741824 #convert bytes -> gigabytes
        print "%16s%18d%18s%18d" % (ip, mem, disk_used, disk_free)

if __name__ == '__main__':

Maybe if you let us know exactly what type of utilization stats you are looking for that would help guide you to the right tool(s). I completely understand why you want DomU stats but I'm not quite following why you want the detailed info on Dom0. I suppose if I knew exactly what you were looking for I might understand :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy