added new 'limit' functionality to 'nvidia' graph

This commit is contained in:
Jordi Sanfeliu 2014-06-18 10:34:39 +02:00
parent 8e1e192587
commit 56af232c9c
1 changed files with 12 additions and 14 deletions

View File

@ -235,6 +235,8 @@ sub nvidia_cgi {
my ($package, $config, $cgi) = @_; my ($package, $config, $cgi) = @_;
my $nvidia = $config->{nvidia}; my $nvidia = $config->{nvidia};
my @rigid = split(',', ($nvidia->{rigid} || ""));
my @limit = split(',', ($nvidia->{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};
@ -244,6 +246,7 @@ sub nvidia_cgi {
my $u = ""; my $u = "";
my $width; my $width;
my $height; my $height;
my @riglim;
my $temp_scale = "Celsius"; my $temp_scale = "Celsius";
my @tmp; my @tmp;
my @tmpz; my @tmpz;
@ -363,6 +366,7 @@ sub nvidia_cgi {
main::graph_header($title, 2); main::graph_header($title, 2);
} }
@riglim = @{setup_riglim($rigid[0], $limit[0])};
for($n = 0; $n < 9; $n++) { for($n = 0; $n < 9; $n++) {
if($n < $nvidia->{max}) { if($n < $nvidia->{max}) {
push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":Card $n"); push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":Card $n");
@ -420,7 +424,7 @@ sub nvidia_cgi {
"--vertical-label=$temp_scale", "--vertical-label=$temp_scale",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--lower-limit=0", @riglim,
$zoom, $zoom,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
@ -449,7 +453,7 @@ sub nvidia_cgi {
"--vertical-label=$temp_scale", "--vertical-label=$temp_scale",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--lower-limit=0", @riglim,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
"DEF:temp0=$rrd:nvidia_temp0:AVERAGE", "DEF:temp0=$rrd:nvidia_temp0:AVERAGE",
@ -484,6 +488,7 @@ sub nvidia_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");
} }
@riglim = @{setup_riglim($rigid[1], $limit[1])};
undef(@tmp); undef(@tmp);
undef(@tmpz); undef(@tmpz);
undef(@CDEF); undef(@CDEF);
@ -533,9 +538,7 @@ sub nvidia_cgi {
"--vertical-label=Percent", "--vertical-label=Percent",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--upper-limit=100", @riglim,
"--lower-limit=0",
"--rigid",
$zoom, $zoom,
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@ -564,9 +567,7 @@ sub nvidia_cgi {
"--vertical-label=Percent", "--vertical-label=Percent",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--upper-limit=100", @riglim,
"--lower-limit=0",
"--rigid",
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
@ -598,6 +599,7 @@ sub nvidia_cgi {
} }
} }
@riglim = @{setup_riglim($rigid[2], $limit[2])};
undef(@tmp); undef(@tmp);
undef(@tmpz); undef(@tmpz);
undef(@CDEF); undef(@CDEF);
@ -647,9 +649,7 @@ sub nvidia_cgi {
"--vertical-label=Percent", "--vertical-label=Percent",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--upper-limit=100", @riglim,
"--lower-limit=0",
"--rigid",
@{$cgi->{version12}}, @{$cgi->{version12}},
$zoom, $zoom,
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@ -678,9 +678,7 @@ sub nvidia_cgi {
"--vertical-label=Percent", "--vertical-label=Percent",
"--width=$width", "--width=$width",
"--height=$height", "--height=$height",
"--upper-limit=100", @riglim,
"--lower-limit=0",
"--rigid",
@{$cgi->{version12}}, @{$cgi->{version12}},
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},