From efc301ac547ed23808537c710f35acbfa2f109d9 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 29 Oct 2008 16:53:59 +0100 Subject: ignore Xen's Dom0 when calculating totals since we're only interested in the amount of memory vms consume and vms + dom0 == 100%. --- libvirt-mem | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libvirt-mem') diff --git a/libvirt-mem b/libvirt-mem index c7bf63d..5437987 100644 --- a/libvirt-mem +++ b/libvirt-mem @@ -80,8 +80,10 @@ def fetch_values(uri): dom = conn.lookupByID(id) name = dom.name() mem = dom.info()[2] * 1024 - total += mem print "%s_mem.value %d" % (canon(name), mem) + # ignore Xen's Dom0 when calcualting memory total and percentage + if name != "Domain-0": + total += mem print "total.value %d" % total print "total_pc.value %.0f" % (100.0 * total / float(hostmem)) return 0 -- cgit v1.2.3