aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2008-10-29 16:53:59 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-10-29 16:59:31 +0100
commitefc301ac547ed23808537c710f35acbfa2f109d9 (patch)
treeee7fc7d9359fdfe8eb9cfa24380876a738d48637
parent87df1debe3fff47c56425d866daa03a5a2c55fa2 (diff)
ignore Xen's Dom0 when calculating totals
since we're only interested in the amount of memory vms consume and vms + dom0 == 100%.
-rw-r--r--libvirt-mem4
1 files changed, 3 insertions, 1 deletions
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