From ecde5e611a03820c0ef46c9c21fd10867d801777 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 20 Nov 2012 16:44:12 +0100 Subject: [PATCH] 3.0: improved configuration in system.rrd --- 3.0/lib/system.pm | 19 +++++++++++-------- 3.0/monitorix.conf | 10 ++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/3.0/lib/system.pm b/3.0/lib/system.pm index 64619fa..5d3ca34 100644 --- a/3.0/lib/system.pm +++ b/3.0/lib/system.pm @@ -286,6 +286,9 @@ sub system_update { sub system_cgi { my ($package, $config, $cgi) = @_; + my %system = %{$config->{system}}; + my @rigid = split(',', $system{rigid}); + my @limit = split(',', $system{limit}); my $tf = $cgi->{tf}; my $colors = $cgi->{colors}; my $graph = $cgi->{graph}; @@ -385,11 +388,11 @@ sub system_cgi { if($title) { main::graph_header($title, 2); } - if($config->{system1_rigid} eq 1) { - push(@riglim, "--upper-limit=$config->{system1_limit}"); + if(trim($rigid[0]) eq 1) { + push(@riglim, "--upper-limit=" . trim($limit[0])); } else { - if($config->{system1_rigid} eq 2) { - push(@riglim, "--upper-limit=$config->{system1_limit}"); + if(trim($rigid[0]) eq 2) { + push(@riglim, "--upper-limit=" . trim($limit[0])); push(@riglim, "--rigid"); } } @@ -491,11 +494,11 @@ sub system_cgi { } undef(@riglim); - if($config->{system2_rigid} eq 1) { - push(@riglim, "--upper-limit=$config->{system2_limit}"); + if(trim($rigid[1]) eq 1) { + push(@riglim, "--upper-limit=" . trim($limit[1])); } else { - if($config->{system2_rigid} eq 2) { - push(@riglim, "--upper-limit=$config->{system2_limit}"); + if(trim($rigid[1]) eq 2) { + push(@riglim, "--upper-limit=" . trim($limit[1])); push(@riglim, "--rigid"); } } diff --git a/3.0/monitorix.conf b/3.0/monitorix.conf index 54c7d97..b15af34 100644 --- a/3.0/monitorix.conf +++ b/3.0/monitorix.conf @@ -82,12 +82,10 @@ alert_rootfs_script = /path/to/script.sh # SYSTEM graph # ----------------------------------------------------------------------------- -# - system1_rigid = 1 - system1_limit = 1 - system2_rigid = 0 - system2_limit = 100 -# + + rigid = 1, 0 + limit = 1, 100 + # KERNEL graph