From 5dc3787f00676bba8f521dbf3fd228f38c6f7445 Mon Sep 17 00:00:00 2001 From: Ken-ichi Mito Date: Wed, 8 May 2013 23:51:44 +0900 Subject: [PATCH] add new option 'env.stack_usage' to lxc_ram * draw memory usages of containers as stacked area charts * the type of other graphs are not changed (default -> LINE2) --- plugins/lxc/lxc_ram | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/lxc/lxc_ram b/plugins/lxc/lxc_ram index db770778..004f829a 100755 --- a/plugins/lxc/lxc_ram +++ b/plugins/lxc/lxc_ram @@ -12,10 +12,18 @@ lxc_ram - Plugin to monitor LXC memory usage. [lxc_*] user root + [lxc_ram] + env.stack_usage true + =head1 INTERPRETATION This plugin needs root privilege. +If env.stack_usage is set to true, all memory usages of containers will be + drawn as stacked area charts. +This option changes graph order, all of 'Mem usage' comes first and then others. +(default: empty) + =head1 AUTHOR vajtsz vajtsz@gmail.com @@ -62,13 +70,24 @@ if [ "$1" = "config" ]; then echo 'graph_vlabel byte' echo 'graph_category memory' + if [ "$stack_usage" = "true" ]; then + for guest_name in $guest_names; do + guest="$(clean_fieldname $guest_name)" + + echo 'mem_usage_'$guest'.label '$guest_name': Mem usage' + echo 'mem_usage_'$guest'.type GAUGE' + echo 'mem_usage_'$guest'.draw AREASTACK' + done + fi for guest_name in $guest_names; do guest="$(clean_fieldname $guest_name)" - echo 'mem_usage_'$guest'.label '$guest_name': Mem usage' - echo 'mem_usage_'$guest'.type GAUGE' + if [ "$stack_usage" != "true" ]; then + echo 'mem_usage_'$guest'.label '$guest_name': Mem usage' + echo 'mem_usage_'$guest'.type GAUGE' + fi echo 'mem_cache_'$guest'.label '$guest_name': Cache' echo 'mem_cache_'$guest'.type GAUGE' echo 'mem_active_'$guest'.label '$guest_name': Active'