From 56af232c9c92a96f0dd617c9da5eacfde033a5df Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 18 Jun 2014 10:34:39 +0200 Subject: [PATCH] added new 'limit' functionality to 'nvidia' graph --- lib/nvidia.pm | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/nvidia.pm b/lib/nvidia.pm index b29df42..deedf5b 100644 --- a/lib/nvidia.pm +++ b/lib/nvidia.pm @@ -235,6 +235,8 @@ sub nvidia_cgi { my ($package, $config, $cgi) = @_; my $nvidia = $config->{nvidia}; + my @rigid = split(',', ($nvidia->{rigid} || "")); + my @limit = split(',', ($nvidia->{limit} || "")); my $tf = $cgi->{tf}; my $colors = $cgi->{colors}; my $graph = $cgi->{graph}; @@ -244,6 +246,7 @@ sub nvidia_cgi { my $u = ""; my $width; my $height; + my @riglim; my $temp_scale = "Celsius"; my @tmp; my @tmpz; @@ -363,6 +366,7 @@ sub nvidia_cgi { main::graph_header($title, 2); } + @riglim = @{setup_riglim($rigid[0], $limit[0])}; for($n = 0; $n < 9; $n++) { if($n < $nvidia->{max}) { push(@tmp, "LINE2:temp_" . $n . $LC[$n] . ":Card $n"); @@ -420,7 +424,7 @@ sub nvidia_cgi { "--vertical-label=$temp_scale", "--width=$width", "--height=$height", - "--lower-limit=0", + @riglim, $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, @@ -449,7 +453,7 @@ sub nvidia_cgi { "--vertical-label=$temp_scale", "--width=$width", "--height=$height", - "--lower-limit=0", + @riglim, @{$cgi->{version12}}, @{$colors->{graph_colors}}, "DEF:temp0=$rrd:nvidia_temp0:AVERAGE", @@ -484,6 +488,7 @@ sub nvidia_cgi { print(" \n"); print(" \n"); } + @riglim = @{setup_riglim($rigid[1], $limit[1])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -533,9 +538,7 @@ sub nvidia_cgi { "--vertical-label=Percent", "--width=$width", "--height=$height", - "--upper-limit=100", - "--lower-limit=0", - "--rigid", + @riglim, $zoom, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @@ -564,9 +567,7 @@ sub nvidia_cgi { "--vertical-label=Percent", "--width=$width", "--height=$height", - "--upper-limit=100", - "--lower-limit=0", - "--rigid", + @riglim, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, @@ -598,6 +599,7 @@ sub nvidia_cgi { } } + @riglim = @{setup_riglim($rigid[2], $limit[2])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -647,9 +649,7 @@ sub nvidia_cgi { "--vertical-label=Percent", "--width=$width", "--height=$height", - "--upper-limit=100", - "--lower-limit=0", - "--rigid", + @riglim, @{$cgi->{version12}}, $zoom, @{$cgi->{version12_small}}, @@ -678,9 +678,7 @@ sub nvidia_cgi { "--vertical-label=Percent", "--width=$width", "--height=$height", - "--upper-limit=100", - "--lower-limit=0", - "--rigid", + @riglim, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}},