From ac2b5ba7379ca158bf173e9e79951ae98818398e Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 19 Jun 2014 11:35:59 +0200 Subject: [PATCH] added new 'limit' functionality to 'apache' graph --- lib/apache.pm | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/lib/apache.pm b/lib/apache.pm index d13e2c6..4535bb4 100644 --- a/lib/apache.pm +++ b/lib/apache.pm @@ -207,8 +207,8 @@ sub apache_cgi { my ($package, $config, $cgi) = @_; my $apache = $config->{apache}; - my @rigid = split(',', $apache->{rigid}); - my @limit = split(',', $apache->{limit}); + my @rigid = split(',', ($apache->{rigid} || "")); + my @limit = split(',', ($apache->{limit} || "")); my $tf = $cgi->{tf}; my $colors = $cgi->{colors}; my $graph = $cgi->{graph}; @@ -331,15 +331,7 @@ sub apache_cgi { if($title) { main::graph_header($title, 2); } - undef(@riglim); - if(trim($rigid[0]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[0])); - } else { - if(trim($rigid[0]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[0])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[0], $limit[0])}; if($title) { print(" \n"); print(" \n"); @@ -384,7 +376,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, @@ -409,7 +400,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$colors->{graph_colors}}, "DEF:apache" . $e . "_busy=$rrd:apache" . $e . "_busy:AVERAGE", @@ -439,15 +429,7 @@ sub apache_cgi { print(" \n"); print(" \n"); } - undef(@riglim); - if(trim($rigid[1]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[1])); - } else { - if(trim($rigid[1]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[1])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[1], $limit[1])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -478,7 +460,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @@ -499,7 +480,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, @@ -524,15 +504,7 @@ sub apache_cgi { } } - undef(@riglim); - if(trim($rigid[2]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[2])); - } else { - if(trim($rigid[2]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[2])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[2], $limit[2])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -563,7 +535,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @@ -584,7 +555,6 @@ sub apache_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}},