From 89266d9b5640607d53b414df73b8f7be4b6f1226 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 23 Oct 2008 13:37:32 +0200 Subject: make cputime graphs stackable use "env.stack 1" for that. Since we can't exceed 100% of cputime this can be useful. --- libvirt-cputime | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libvirt-cputime') diff --git a/libvirt-cputime b/libvirt-cputime index 42884a5..8758b17 100644 --- a/libvirt-cputime +++ b/libvirt-cputime @@ -19,7 +19,7 @@ import libvirt def canon(name): return re.sub(r"[^a-zA-Z0-9_]", "_", name) -def print_config(uri): +def print_config(uri, stack): """print the plugin config, determine the domains""" print """graph_title Virtual Domain Cpu Time @@ -28,6 +28,7 @@ graph_category Virtual Machines graph_info This graph shows the cpu time percentage of each virtual machine graph_args --base 1000 -l 0""" + draw = [ "LINE1", "AREA"][stack] conn = libvirt.openReadOnly(uri) ids = conn.listDomainsID() for id in ids: @@ -36,6 +37,9 @@ graph_args --base 1000 -l 0""" print "%s_cputime.label %s" % (canon(name), name) print "%s_cputime.type DERIVE" % canon(name) print "%s_cputime.min 0" % canon(name) + print "%s_cputime.draw %s" % (canon(name), draw) + if draw == "AREA": + draw = "STACK" def fetch_values(uri): @@ -53,6 +57,7 @@ def fetch_values(uri): def main(sys): uri = os.getenv("uri", "qemu:///system") + stack = [ False, True ][os.getenv("stack") == "1"] if len(sys) > 1: if sys[1] in [ 'autoconf', 'detect' ]: @@ -63,7 +68,7 @@ def main(sys): print "no" return 1 elif sys[1] == 'config': - print_config(uri) + print_config(uri, stack) return 0 fetch_values(uri) return 0 -- cgit v1.2.3