Fix wrong index for image directory.

The number of plots was wrongly fixed to 3 instead of the actual number.
This commit is contained in:
Andreas Bachlechner 2022-01-28 17:30:03 +01:00
parent 738bbfd5be
commit fc26d6db8b
3 changed files with 21 additions and 21 deletions

View File

@ -679,7 +679,7 @@ sub amdgpu_cgi {
$cdef_sensor_allvalues .= ",0,GT,1,UNKN,IF";
}
my $plot_title = $config->{graphs}->{'_amdgpu' . ($n_plot + 1)};
$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 3 + $n_plot]",
$pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_sensor_values_in_use + $n_plot],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -697,10 +697,10 @@ sub amdgpu_cgi {
@CDEF,
@tmp);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 3 + $n_plot]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMG[$e * $number_of_sensor_values_in_use + $n_plot]. ": $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 3 + $n_plot]",
$picz = $rrd{$version}->("$IMG_DIR" . $IMGz[$e * $number_of_sensor_values_in_use + $n_plot],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -719,13 +719,13 @@ sub amdgpu_cgi {
@CDEF,
@tmpz);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 3 + $n_plot]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMGz[$e * $number_of_sensor_values_in_use + $n_plot]. ": $err\n") if $err;
}
$e2 = $e + $n_plot + 1;
if($title || ($silent =~ /imagetag/ && $graph =~ /amdgpu$e2/)) {
if(lc($config->{enable_zoom}) eq "y") {
if(lc($config->{disable_javascript_void}) eq "y") {
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * 3 + $n_plot], IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * $number_of_sensor_values_in_use + $n_plot], IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
} else {
if($version eq "new") {
$picz_width = $picz->{image_width} * $config->{global_zoom};
@ -734,10 +734,10 @@ sub amdgpu_cgi {
$picz_width = $width + 115;
$picz_height = $height + 100;
}
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * 3 + $n_plot], IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * $number_of_sensor_values_in_use + $n_plot], IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
}
} else {
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
}
}
}

View File

@ -632,7 +632,7 @@ sub nvidiagpu_cgi {
$cdef_sensor_allvalues .= ",0,GT,1,UNKN,IF";
}
my $plot_title = $config->{graphs}->{'_nvidiagpu' . ($n_plot + 1)};
$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 3 + $n_plot]",
$pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_sensor_values_in_use + $n_plot],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -650,10 +650,10 @@ sub nvidiagpu_cgi {
@CDEF,
@tmp);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 3 + $n_plot]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMG[$e * $number_of_sensor_values_in_use + $n_plot] . ": $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 3 + $n_plot]",
$picz = $rrd{$version}->("$IMG_DIR" . $IMGz[$e * $number_of_sensor_values_in_use + $n_plot],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -672,13 +672,13 @@ sub nvidiagpu_cgi {
@CDEF,
@tmpz);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 3 + $n_plot]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMGz[$e * $number_of_sensor_values_in_use + $n_plot]. ": $err\n") if $err;
}
$e2 = $e + $n_plot + 1;
if($title || ($silent =~ /imagetag/ && $graph =~ /nvidiagpu$e2/)) {
if(lc($config->{enable_zoom}) eq "y") {
if(lc($config->{disable_javascript_void}) eq "y") {
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * 3 + $n_plot], IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * $number_of_sensor_values_in_use + $n_plot], IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
} else {
if($version eq "new") {
$picz_width = $picz->{image_width} * $config->{global_zoom};
@ -687,10 +687,10 @@ sub nvidiagpu_cgi {
$picz_width = $width + 115;
$picz_height = $height + 100;
}
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * 3 + $n_plot], IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * $number_of_sensor_values_in_use + $n_plot], IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
}
} else {
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * 3 + $n_plot]) . "\n");
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * $number_of_sensor_values_in_use + $n_plot]) . "\n");
}
}
}

View File

@ -631,7 +631,7 @@ sub nvme_cgi {
push(@scaling_options, "--alt-y-grid");
}
my $plot_title = $config->{graphs}->{'_nvme' . ($n_smart + 1)};
$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 3 + $n_smart]",
$pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_smart_values_in_use + $n_smart],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -650,10 +650,10 @@ sub nvme_cgi {
@CDEF,
@tmp);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 3 + $n_smart]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMG[$e * $number_of_smart_values_in_use + $n_smart]. ": $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 3 + $n_smart]",
$picz = $rrd{$version}->("$IMG_DIR" . $IMGz[$e * $number_of_smart_values_in_use + $n_smart],
"--title=$plot_title ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=$imgfmt_uc",
@ -673,13 +673,13 @@ sub nvme_cgi {
@CDEF,
@tmpz);
$err = RRDs::error;
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 3 + $n_smart]: $err\n") if $err;
push(@output, "ERROR: while graphing $IMG_DIR" . $IMGz[$e * $number_of_smart_values_in_use + $n_smart]. ": $err\n") if $err;
}
$e2 = $e + $n_smart + 1;
if($title || ($silent =~ /imagetag/ && $graph =~ /nvme$e2/)) {
if(lc($config->{enable_zoom}) eq "y") {
if(lc($config->{disable_javascript_void}) eq "y") {
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * 3 + $n_smart], IMG => $IMG[$e * 3 + $n_smart]) . "\n");
push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * $number_of_smart_values_in_use + $n_smart], IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n");
} else {
if($version eq "new") {
$picz_width = $picz->{image_width} * $config->{global_zoom};
@ -688,10 +688,10 @@ sub nvme_cgi {
$picz_width = $width + 115;
$picz_height = $height + 100;
}
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * 3 + $n_smart], IMG => $IMG[$e * 3 + $n_smart]) . "\n");
push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * $number_of_smart_values_in_use + $n_smart], IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n");
}
} else {
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * 3 + $n_smart]) . "\n");
push(@output, " " . img_element(config => $config, IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n");
}
}
}