added new 'limit' functionality to 'apache' graph

This commit is contained in:
Jordi Sanfeliu 2014-06-19 11:35:59 +02:00
parent 916e364faa
commit ac2b5ba737
1 changed files with 5 additions and 35 deletions

View File

@ -207,8 +207,8 @@ sub apache_cgi {
my ($package, $config, $cgi) = @_; my ($package, $config, $cgi) = @_;
my $apache = $config->{apache}; my $apache = $config->{apache};
my @rigid = split(',', $apache->{rigid}); my @rigid = split(',', ($apache->{rigid} || ""));
my @limit = split(',', $apache->{limit}); my @limit = split(',', ($apache->{limit} || ""));
my $tf = $cgi->{tf}; my $tf = $cgi->{tf};
my $colors = $cgi->{colors}; my $colors = $cgi->{colors};
my $graph = $cgi->{graph}; my $graph = $cgi->{graph};
@ -331,15 +331,7 @@ sub apache_cgi {
if($title) { if($title) {
main::graph_header($title, 2); main::graph_header($title, 2);
} }
undef(@riglim); @riglim = @{setup_riglim($rigid[0], $limit[0])};
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");
}
}
if($title) { if($title) {
print(" <tr>\n"); print(" <tr>\n");
print(" <td bgcolor='$colors->{title_bg_color}'>\n"); print(" <td bgcolor='$colors->{title_bg_color}'>\n");
@ -384,7 +376,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
$zoom, $zoom,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
@ -409,7 +400,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
"DEF:apache" . $e . "_busy=$rrd:apache" . $e . "_busy:AVERAGE", "DEF:apache" . $e . "_busy=$rrd:apache" . $e . "_busy:AVERAGE",
@ -439,15 +429,7 @@ sub apache_cgi {
print(" </td>\n"); print(" </td>\n");
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n"); print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
} }
undef(@riglim); @riglim = @{setup_riglim($rigid[1], $limit[1])};
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");
}
}
undef(@tmp); undef(@tmp);
undef(@tmpz); undef(@tmpz);
undef(@CDEF); undef(@CDEF);
@ -478,7 +460,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
$zoom, $zoom,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@ -499,7 +480,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
@ -524,15 +504,7 @@ sub apache_cgi {
} }
} }
undef(@riglim); @riglim = @{setup_riglim($rigid[2], $limit[2])};
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");
}
}
undef(@tmp); undef(@tmp);
undef(@tmpz); undef(@tmpz);
undef(@CDEF); undef(@CDEF);
@ -563,7 +535,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
$zoom, $zoom,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@ -584,7 +555,6 @@ sub apache_cgi {
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
@riglim, @riglim,
"--lower-limit=0",
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},