mirror of https://github.com/mikaku/Monitorix.git
added new 'limit' functionality to 'nginx' graph
This commit is contained in:
parent
ac2b5ba737
commit
f1323455cf
39
lib/nginx.pm
39
lib/nginx.pm
|
@ -244,8 +244,8 @@ sub nginx_cgi {
|
||||||
my ($package, $config, $cgi) = @_;
|
my ($package, $config, $cgi) = @_;
|
||||||
|
|
||||||
my $nginx = $config->{nginx};
|
my $nginx = $config->{nginx};
|
||||||
my @rigid = split(',', $nginx->{rigid});
|
my @rigid = split(',', ($nginx->{rigid} || ""));
|
||||||
my @limit = split(',', $nginx->{limit});
|
my @limit = split(',', ($nginx->{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};
|
||||||
|
@ -350,14 +350,7 @@ sub nginx_cgi {
|
||||||
if($title) {
|
if($title) {
|
||||||
main::graph_header($title, 2);
|
main::graph_header($title, 2);
|
||||||
}
|
}
|
||||||
if(trim($rigid[0]) eq 1) {
|
@riglim = @{setup_riglim($rigid[0], $limit[0])};
|
||||||
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");
|
||||||
|
@ -415,7 +408,6 @@ sub nginx_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}},
|
||||||
|
@ -439,7 +431,6 @@ sub nginx_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:total=$rrd:nginx_total:AVERAGE",
|
"DEF:total=$rrd:nginx_total:AVERAGE",
|
||||||
|
@ -469,15 +460,7 @@ sub nginx_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);
|
||||||
|
@ -508,7 +491,6 @@ sub nginx_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}},
|
||||||
|
@ -529,7 +511,6 @@ sub nginx_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}},
|
||||||
|
@ -588,15 +569,7 @@ sub nginx_cgi {
|
||||||
push(@warning, $colors->{warning_color});
|
push(@warning, $colors->{warning_color});
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -641,7 +614,6 @@ sub nginx_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}},
|
||||||
|
@ -664,7 +636,6 @@ sub nginx_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}},
|
||||||
|
|
Loading…
Reference in New Issue