aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2019-04-30 19:25:25 +0200
committerGitHub <noreply@github.com>2019-04-30 19:25:25 +0200
commit8f790ff9abe8ed22bceb72c79e666cc7d0754540 (patch)
treef0f14d25a85baa4218fd3b4c9f2f5ba753957b9d
parentd704cf7062110e267b85102c986d8020ad368d6b (diff)
parentdac37a8697332f88f8387c377fab8a303b091f10 (diff)
Merge pull request #1 from ProgVal/mem-order
Reorder services in libvirt-mem so they have the same color as on other graphs.
-rw-r--r--libvirt-mem41
1 files changed, 22 insertions, 19 deletions
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):