From dac37a8697332f88f8387c377fab8a303b091f10 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 28 Mar 2019 18:52:23 +0100 Subject: Reorder services in libvirt-mem so they have the same color as on other graphs. --- libvirt-mem | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'libvirt-mem') diff --git a/libvirt-mem b/libvirt-mem index cf9bd6b..80e1d3a 100644 --- a/libvirt-mem +++ b/libvirt-mem @@ -34,7 +34,28 @@ def print_config(uri): graph_vlabel Memory Usage / Bytes graph_category Virtual Machines graph_info This graph shows the current amount of memory used by each virtual machine -graph_args --base 1024 -l 0 +graph_args --base 1024 -l 0""" + + ids = conn.listDomainsID() + draw = "AREA" + for id in ids: + try: + dom = conn.lookupByID(id) + name = dom.name() + except libvirt.libvirtError, err: + print >>sys.stderr, "Id: %s: %s" % (id, err) + continue + if name == "Domain-0": + continue + print "%s_mem.label %s" % (canon(name), name) + print "%s_mem.type GAUGE" % canon(name) + print "%s_mem.min 0" % canon(name) + print "%s_mem.draw %s" % (canon(name), draw) + print "%s_mem.info memory used by virtual machine '%s'" % (canon(name), name) + if draw == "AREA": + draw = "STACK" + + print """ host_mem.label %(hostname)s (host) host_mem.type GAUGE host_mem.min 0 @@ -92,24 +113,6 @@ total_soft_limit_pc.min 0 """ % dict(hostname=hostname) - ids = conn.listDomainsID() - draw = "AREA" - for id in ids: - try: - dom = conn.lookupByID(id) - name = dom.name() - except libvirt.libvirtError, err: - print >>sys.stderr, "Id: %s: %s" % (id, err) - continue - if name == "Domain-0": - continue - print "%s_mem.label %s" % (canon(name), name) - print "%s_mem.type GAUGE" % canon(name) - print "%s_mem.min 0" % canon(name) - print "%s_mem.draw %s" % (canon(name), draw) - print "%s_mem.info memory used by virtual machine '%s'" % (canon(name), name) - if draw == "AREA": - draw = "STACK" return 0 def get_memtune(dom): -- cgit v1.2.3