From 968f63b3ae934a64e871d5b012e317ce5baff6e3 Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:59:42 +0100 Subject: [PATCH 1/8] Add data units read and data units read/s and written/s. --- lib/nvme.pm | 268 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 162 insertions(+), 106 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 35dee72..5c62a4f 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -24,6 +24,7 @@ use strict; use warnings; use Monitorix; use RRDs; +use Time::HiRes; use Cwd 'abs_path'; use File::Basename; use Exporter 'import'; @@ -32,6 +33,162 @@ our @EXPORT = qw(nvme_init nvme_update nvme_cgi); my $max_number_of_hds = 8; # Changing this number destroys history. my $number_of_smart_values_in_rrd = 9; # Changing this number destroys history. +my $epoc_identifier = "last_epoc"; +my $data_units_written_identifier = "last_duw"; +my $data_units_read_identifier = "last_dur"; + +sub measure { + my ($myself, $config, $nvme) = @_; + my $use_nan_for_missing_data = lc($nvme->{use_nan_for_missing_data} || "") eq "y" ? 1 : 0; + + my @smart_all; + my $rrdata = "N"; + + foreach my $k (sort keys %{$nvme->{list}}) { + # values delimitted by ", " (comma + space) + my @dsk = split(', ', $nvme->{list}->{$k}); + for(my $n = 0; $n < $max_number_of_hds; $n++) { + my @smart = ($use_nan_for_missing_data ? (0+"nan") : 0) x $number_of_smart_values_in_rrd; + + if($dsk[$n]) { + my $d = trim($dsk[$n]); + $d =~ s/^\"//; + $d =~ s/\"$//; + + # check if device name is a symbolic link + # e.g. /dev/nvme/by-path/pci-0000:07:07.0-scsi-0:0:0:0 + if(-l $d) { + $d = abs_path(dirname($d) . "/" . readlink($d)); + chomp($d); + } + + my $last_epoc = ($config->{nvme_hist}->{$k}->{$n}->{$epoc_identifier} || 0); + my $epoc = Time::HiRes::time(); + $config->{nvme_hist}->{$k}->{$n}->{$epoc_identifier} = $epoc; + my $data_units_written_index; + my $data_units_read_index; + + open(IN, "smartctl -A $d --json |"); + while() { + if(/\"temperature\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + if (index($tmp[1], "{") == -1) { + my $smartIndex = 0; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + } + if(/\"available_spare\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 1; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + if(/\"percentage_used\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 2; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + if(/\"data_units_written\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 3; + $data_units_written_index = $smartIndex; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + if(/\"media_errors\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 4; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + if(/\"unsafe_shutdowns\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 5; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + if(/\"data_units_read\"/) { + my @tmp = split(':', $_); + $tmp[1] =~ tr/,//d; + my $smartIndex = 6; + $data_units_read_index = $smartIndex; + $smart[$smartIndex] = trim($tmp[1]); + chomp($smart[$smartIndex]); + } + } + close(IN); + + if (defined($data_units_written_index)) { + my $smartIndex = 7; + my $last_data_units_written = ($config->{nvme_hist}->{$k}->{$n}->{$data_units_written_identifier} || 0); + my $data_units_written = $smart[$data_units_written_index]; + $config->{nvme_hist}->{$k}->{$n}->{$data_units_written_identifier} = $data_units_written; +# logger("$myself: HUHU duw=". $data_units_written . ", lduw=".$last_data_units_written); + if ($last_epoc ne 0 && $data_units_written >= $last_data_units_written) { + $smart[$smartIndex] = ($data_units_written - $last_data_units_written) / ($epoc - $last_epoc); # Calculation of data units per seconds. +# logger("$myself: HUHU duw/s=". ($smart[$smartIndex] * 512000). " bytes/s"); + } + } + if (defined($data_units_read_index)) { + my $smartIndex = 8; + my $last_data_units_read = ($config->{nvme_hist}->{$k}->{$n}->{$data_units_read_identifier} || 0); + my $data_units_read = $smart[$data_units_read_index]; + $config->{nvme_hist}->{$k}->{$n}->{$data_units_read_identifier} = $data_units_read; +# logger("$myself: HUHU dur=". $data_units_read . ", ldur=".$last_data_units_read); + if ($last_epoc ne 0 && $data_units_read >= $last_data_units_read) { + $smart[$smartIndex] = ($data_units_read - $last_data_units_read) / ($epoc - $last_epoc); # Calculation of data units per seconds. +# logger("$myself: HUHU dur/s=". ($smart[$smartIndex] * 512000). " bytes/s"); + } + } + } + + push(@smart_all, @smart); + + # nvme alert + if(defined($nvme->{alerts}) && lc($nvme->{alerts}->{availspare_enabled}) eq "y") { + my $smartIndex = 1; + $config->{nvme_hist_alert1}->{$n} = 0 if(!$config->{nvme_hist_alert1}->{$n}); + if($smart[$smartIndex] <= $nvme->{alerts}->{availspare_threshold} && $config->{nvme_hist_alert1}->{$n} < $smart[$smartIndex]) { + if(-x $nvme->{alerts}->{availspare_script}) { + logger("$myself: ALERT: executing script '$nvme->{alerts}->{availspare_script}'."); + system($nvme->{alerts}->{availspare_script} . " " .$nvme->{alerts}->{availspare_timeintvl} . " " . $nvme->{alerts}->{availspare_threshold} . " " . $smart[$smartIndex]); + } else { + logger("$myself: ERROR: script '$nvme->{alerts}->{availspare_script}' doesn't exist or don't has execution permissions."); + } + $config->{nvme_hist_alert1}->{$n} = $smart[$smartIndex]; + } + } + if(defined($nvme->{alerts}) && lc($nvme->{alerts}->{percentused_enabled}) eq "y") { + my $smartIndex = 2; + $config->{nvme_hist_alert2}->{$n} = 0 if(!$config->{nvme_hist_alert2}->{$n}); + if($smart[$smartIndex] >= $nvme->{alerts}->{percentused_threshold} && $config->{nvme_hist_alert2}->{$n} < $smart[$smartIndex]) { + if(-x $nvme->{alerts}->{percentused_script}) { + logger("$myself: ALERT: executing script '$nvme->{alerts}->{percentused_script}'."); + system($nvme->{alerts}->{percentused_script} . " " .$nvme->{alerts}->{percentused_timeintvl} . " " . $nvme->{alerts}->{percentused_threshold} . " " . $smart[$smartIndex]); + } else { + logger("$myself: ERROR: script '$nvme->{alerts}->{percentused_script}' doesn't exist or don't has execution permissions."); + } + $config->{nvme_hist_alert2}->{$n} = $smart[$smartIndex]; + } + } + } + } + + foreach(@smart_all) { + $rrdata .= ":$_"; + } + + return $rrdata; +} + sub nvme_init { my $myself = (caller(0))[3]; my ($package, $config, $debug) = @_; @@ -173,7 +330,11 @@ sub nvme_init { $config->{nvme_hist_alert1} = (); $config->{nvme_hist_alert2} = (); + $config->{nvme_hist} = (); push(@{$config->{func_update}}, $package); + + measure($myself, $config, $nvme); + logger("$myself: Ok") if $debug; } @@ -182,113 +343,8 @@ sub nvme_update { my ($package, $config, $debug) = @_; my $rrd = $config->{base_lib} . $package . ".rrd"; my $nvme = $config->{nvme}; - my $use_nan_for_missing_data = lc($nvme->{use_nan_for_missing_data} || "") eq "y" ? 1 : 0; - my @smart; - - my $n; - my $rrdata = "N"; - - foreach my $k (sort keys %{$nvme->{list}}) { - # values delimitted by ", " (comma + space) - my @dsk = split(', ', $nvme->{list}->{$k}); - for($n = 0; $n < $max_number_of_hds; $n++) { - @smart = ($use_nan_for_missing_data ? (0+"nan") : 0) x $number_of_smart_values_in_rrd; - - if($dsk[$n]) { - my $d = trim($dsk[$n]); - $d =~ s/^\"//; - $d =~ s/\"$//; - - # check if device name is a symbolic link - # e.g. /dev/nvme/by-path/pci-0000:07:07.0-scsi-0:0:0:0 - if(-l $d) { - $d = abs_path(dirname($d) . "/" . readlink($d)); - chomp($d); - } - - open(IN, "smartctl -A $d --json |"); - while() { - if(/\"temperature\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - if (index($tmp[1], "{") == -1) { - my $smartIndex = 0; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - } - if(/\"available_spare\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - my $smartIndex = 1; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - if(/\"percentage_used\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - my $smartIndex = 2; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - if(/\"data_units_written\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - my $smartIndex = 3; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - if(/\"media_errors\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - my $smartIndex = 4; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - if(/\"unsafe_shutdowns\"/) { - my @tmp = split(':', $_); - $tmp[1] =~ tr/,//d; - my $smartIndex = 5; - $smart[$smartIndex] = trim($tmp[1]); - chomp($smart[$smartIndex]); - } - } - close(IN); - } - foreach(@smart) { - $rrdata .= ":$_"; - } - - # nvme alert - if(defined($nvme->{alerts}) && lc($nvme->{alerts}->{availspare_enabled}) eq "y") { - my $smartIndex = 1; - $config->{nvme_hist_alert1}->{$n} = 0 if(!$config->{nvme_hist_alert1}->{$n}); - if($smart[$smartIndex] <= $nvme->{alerts}->{availspare_threshold} && $config->{nvme_hist_alert1}->{$n} < $smart[$smartIndex]) { - if(-x $nvme->{alerts}->{availspare_script}) { - logger("$myself: ALERT: executing script '$nvme->{alerts}->{availspare_script}'."); - system($nvme->{alerts}->{availspare_script} . " " .$nvme->{alerts}->{availspare_timeintvl} . " " . $nvme->{alerts}->{availspare_threshold} . " " . $smart[$smartIndex]); - } else { - logger("$myself: ERROR: script '$nvme->{alerts}->{availspare_script}' doesn't exist or don't has execution permissions."); - } - $config->{nvme_hist_alert1}->{$n} = $smart[$smartIndex]; - } - } - if(defined($nvme->{alerts}) && lc($nvme->{alerts}->{percentused_enabled}) eq "y") { - my $smartIndex = 2; - $config->{nvme_hist_alert2}->{$n} = 0 if(!$config->{nvme_hist_alert2}->{$n}); - if($smart[$smartIndex] >= $nvme->{alerts}->{percentused_threshold} && $config->{nvme_hist_alert2}->{$n} < $smart[$smartIndex]) { - if(-x $nvme->{alerts}->{percentused_script}) { - logger("$myself: ALERT: executing script '$nvme->{alerts}->{percentused_script}'."); - system($nvme->{alerts}->{percentused_script} . " " .$nvme->{alerts}->{percentused_timeintvl} . " " . $nvme->{alerts}->{percentused_threshold} . " " . $smart[$smartIndex]); - } else { - logger("$myself: ERROR: script '$nvme->{alerts}->{percentused_script}' doesn't exist or don't has execution permissions."); - } - $config->{nvme_hist_alert2}->{$n} = $smart[$smartIndex]; - } - } - } - } + my $rrdata = measure($myself, $config, $nvme); RRDs::update($rrd, $rrdata); logger("$myself: $rrdata") if $debug; From 2d974606d91db8e4ebeffc0c32b5225982a41d61 Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:18:50 +0100 Subject: [PATCH 2/8] Add plots for read and write load and also for total read bytes. --- lib/nvme.pm | 162 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 94 insertions(+), 68 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index bcd02a9..41d5102 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -403,7 +403,7 @@ sub nvme_cgi { ); my $show_extended_plots = lc($nvme->{show_extended_plots} || "") eq "y" ? 1 : 0; - my $number_of_smart_values_in_use = $show_extended_plots ? 6 : 3; + my $number_of_smart_values_in_use = $show_extended_plots ? 9 : 3; if($number_of_smart_values_in_use > $number_of_smart_values_in_rrd) { logger(@output, "ERROR: Number of smart values (" . $number_of_smart_values_in_use . ") has smaller or equal to number of smart values in rrd (" . $number_of_smart_values_in_rrd . ")!"); return; @@ -503,28 +503,19 @@ sub nvme_cgi { $u = ""; } - for($n = 0; $n < keys(%{$nvme->{list}}); $n++) { - for($n2 = 0; $n2 < $number_of_smart_values_in_use; $n2++) { - $str = $u . $package . $n . $n2 . "." . $tf->{when} . ".$imgfmt_lc"; - push(@IMG, $str); - unlink("$IMG_DIR" . $str); - if(lc($config->{enable_zoom}) eq "y") { - $str = $u . $package . $n . $n2 . "z." . $tf->{when} . ".$imgfmt_lc"; - push(@IMGz, $str); - unlink("$IMG_DIR" . $str); - } - } - } - # Plot settings in order of the smart array. - my @y_axis_titles = ((lc($config->{temperature_scale}) eq "f" ? "Fahrenheit" : "Celsius"), "Percent (%)", "Percent (%)", "bytes", "Errors", "Counts"); - my @value_transformations = ((lc($config->{temperature_scale}) eq "f" ? ",9,*,5,/,32,+" : ""), "", "", ",512000,*", "", ""); - my @legend_labels = ("%2.0lf", "%4.0lf%%", "%4.0lf%%", "%7.3lf%s", "%4.0lf%s", "%4.0lf%s"); - my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 1, 0, 0) : (0, 0, 0); + # Array index is the smart sensor index: + my $total_bytes_format = "%5.1lf%s"; + my $byte_speed_format = "%6.1lf%s"; + my @y_axis_titles = ((lc($config->{temperature_scale}) eq "f" ? "Fahrenheit" : "Celsius"), "Percent (%)", "Percent (%)", "bytes", "Errors", "Counts", "bytes", "bytes/s", "bytes/s"); + my @value_transformations = ((lc($config->{temperature_scale}) eq "f" ? ",9,*,5,/,32,+" : ""), "", "", ",512000,*", "", "", ",512000,*", ",512000,*", ",512000,*"); + my @legend_labels = ("%5.1lf", "%4.0lf%%", "%4.0lf%%", $total_bytes_format, "%4.0lf%s", "%4.0lf%s", $total_bytes_format, $byte_speed_format, $byte_speed_format); - my @plot_order = $show_extended_plots ? (0, 3, 1, 2, 4, 5) : (0, 1, 2); # To rearange the plots - my $main_smart_plots = $show_extended_plots ? 2 : 1; # Number of smart plots on the left side. - my @main_plot_with_average = $show_extended_plots ? (1, 0) : (1); # Wether or not the main plots show average, min and max or only the last value in the legend. + # Array index is the plot index: + my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 1, 1) : (0, 0, 0); + my @plot_order = $show_extended_plots ? (0, 8, 7, 1, 2, 4, 5, 3, 6) : (0, 1, 2); # To rearange the plots + my $main_smart_plots = $show_extended_plots ? 3 : 1; # Number of smart plots on the left side. + my @main_plot_with_average = $show_extended_plots ? (1, 1, 1) : (1); # Wether or not the main plots show average, min and max or only the last value in the legend. if(!$show_extended_plots) { for(my $index = 0; $index < scalar(@plot_order); $index++) { @@ -536,6 +527,7 @@ sub nvme_cgi { $#value_transformations = scalar(@plot_order)-1; $#legend_labels = scalar(@plot_order)-1; } + my $number_of_plots = scalar(@plot_order); if(scalar(@y_axis_titles) != $number_of_smart_values_in_use) { push(@output, "ERROR: Size of y_axis_titles (" . scalar(@y_axis_titles) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); @@ -546,16 +538,29 @@ sub nvme_cgi { if(scalar(@legend_labels) != $number_of_smart_values_in_use) { push(@output, "ERROR: Size of legend_labels (" . scalar(@legend_labels) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } - if(scalar(@alt_axis_scaling) != $number_of_smart_values_in_use) { - push(@output, "ERROR: Size of alt_axis_scaling (" . scalar(@alt_axis_scaling) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); + if(scalar(@alt_axis_scaling) != $number_of_plots) { + push(@output, "ERROR: Size of alt_axis_scaling (" . scalar(@alt_axis_scaling) . ") has to be equal to number_of_plots (" . $number_of_plots . ")"); } - if(scalar(@plot_order) != $number_of_smart_values_in_use) { - push(@output, "ERROR: Size of plot_order (" . scalar(@plot_order) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); + if(scalar(@plot_order) > $number_of_smart_values_in_use) { + push(@output, "ERROR: Size of plot_order (" . scalar(@plot_order) . ") has to be smaller or equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } if(scalar(@main_plot_with_average) != $main_smart_plots) { push(@output, "ERROR: Size of main_plot_with_average (" . scalar(@main_plot_with_average) . ") has to be equal to main_smart_plots (" . $main_smart_plots . ")"); } + for($n = 0; $n < keys(%{$nvme->{list}}); $n++) { + for($n2 = 0; $n2 < $number_of_plots; $n2++) { + $str = $u . $package . $n . $n2 . "." . $tf->{when} . ".$imgfmt_lc"; + push(@IMG, $str); + unlink("$IMG_DIR" . $str); + if(lc($config->{enable_zoom}) eq "y") { + $str = $u . $package . $n . $n2 . "z." . $tf->{when} . ".$imgfmt_lc"; + push(@IMGz, $str); + unlink("$IMG_DIR" . $str); + } + } + } + $e = 0; foreach my $k (sort keys %{$nvme->{list}}) { # values delimitted by ", " (comma + space) @@ -568,7 +573,41 @@ sub nvme_cgi { push(@output, " \n"); push(@output, " \n"); } - for(my $n_plot = 0; $n_plot < $number_of_smart_values_in_use; $n_plot += 1) { + + my @device_strings; + my $max_device_string_length = 0; + for($n = 0; $n < $max_number_of_hds; $n += 1) { + if($d[$n]) { + my $dstr = trim($d[$n]); + my $base = ""; + $dstr =~ s/^\"//; + $dstr =~ s/\"$//; + + # check if device name is a symbolic link + # e.g. /dev/nvme/by-path/pci-0000:07:07.0-scsi-0:0:0:0 + if(-l $dstr) { + $base = basename($dstr); + $dstr = abs_path(dirname($dstr) . "/" . readlink($dstr)); + chomp($dstr); + } + + # $dstr =~ s/^(.+?) .*$/$1/; + if($base && defined($nvme->{map}->{$base})) { + $dstr = $nvme->{map}->{$base}; + } else { + if(defined($nvme->{map}->{$dstr})) { + $dstr = $nvme->{map}->{$dstr}; + } + } + $dstr = trim($dstr); + push(@device_strings, $dstr); + if (length($dstr) > $max_device_string_length) { + $max_device_string_length = length($dstr); + } + } + } + + for(my $n_plot = 0; $n_plot < $number_of_plots; $n_plot += 1) { if($title && $n_plot == $main_smart_plots) { push(@output, " \n"); push(@output, " \n"); @@ -583,51 +622,35 @@ sub nvme_cgi { } for($n = 0; $n < $max_number_of_hds; $n += 1) { if($d[$n]) { - my $dstr = trim($d[$n]); - my $base = ""; - $dstr =~ s/^\"//; - $dstr =~ s/\"$//; - - # check if device name is a symbolic link - # e.g. /dev/nvme/by-path/pci-0000:07:07.0-scsi-0:0:0:0 - if(-l $dstr) { - $base = basename($dstr); - $dstr = abs_path(dirname($dstr) . "/" . readlink($dstr)); - chomp($dstr); - } - - # $dstr =~ s/^(.+?) .*$/$1/; - if($base && defined($nvme->{map}->{$base})) { - $dstr = $nvme->{map}->{$base}; - } else { - if(defined($nvme->{map}->{$dstr})) { - $dstr = $nvme->{map}->{$dstr}; - } - } + my $dstr = $device_strings[$n]; + my $legend_string_length; if($n_plot < $main_smart_plots) { + $legend_string_length = 57; if($main_plot_with_average[$n_plot]) { - $str = sprintf("%-20s", $dstr); - } else { - $str = sprintf("%-57s", $dstr); + $legend_string_length = 20; } } else { + $legend_string_length = 19; if($show_current_values) { - $str = sprintf("%-13s", substr($dstr, 0, 13)); - } else { - $str = sprintf("%-19s", substr($dstr, 0, 19)); + $legend_string_length = min(13, $max_device_string_length); } } + $str = sprintf("%-" . $legend_string_length . "s", substr($dstr, 0, $legend_string_length)) if defined($legend_string_length); my $value_name = "hd" . $n . "_smv" . $n_smart; - push(@tmp, "LINE2:trans_" . $value_name . $LC[$n] . ":$str" . ($n_plot < $main_smart_plots ? "" : ( $show_current_values ? "\\: \\g" : (($n%2 || !$d[$n+1]) ? "\\n" : "")))); + push(@tmp, "LINE2:trans_" . $value_name . $LC[$n] . ":$str" . ($n_plot < $main_smart_plots ? "" : ( $show_current_values ? "\\:\\g" : (($n%2 || !$d[$n+1]) ? "\\n" : "")))); push(@tmpz, "LINE2:trans_" . $value_name . $LC[$n] . ":$dstr"); if($n_plot < $main_smart_plots) { if($main_plot_with_average[$n_plot]) { - push(@tmp, "GPRINT:trans_" . $value_name . ":LAST: Current\\: " . $legend_labels[$n_smart]); - push(@tmp, "GPRINT:trans_" . $value_name . ":AVERAGE: Average\\: " . $legend_labels[$n_smart]); - push(@tmp, "GPRINT:trans_" . $value_name . ":MIN: Min\\: " . $legend_labels[$n_smart]); - push(@tmp, "GPRINT:trans_" . $value_name . ":MAX: Max\\: " . $legend_labels[$n_smart] . "\\n"); + if ($n_smart == 0) { + push(@tmp, "GPRINT:trans_" . $value_name . ":LAST: Current\\:" . $legend_labels[$n_smart]); + } else { + push(@tmp, "GPRINT:trans_" . $value_name . ":LAST:Current\\:" . $legend_labels[$n_smart]); + } + push(@tmp, "GPRINT:trans_" . $value_name . ":AVERAGE:Average\\:" . $legend_labels[$n_smart]); + push(@tmp, "GPRINT:trans_" . $value_name . ":MIN:Min\\:" . $legend_labels[$n_smart]); + push(@tmp, "GPRINT:trans_" . $value_name . ":MAX:Max\\:" . $legend_labels[$n_smart] . "\\n"); } else { - push(@tmp, "GPRINT:trans_" . $value_name . ":LAST: Current\\: " . $legend_labels[$n_smart] . "\\n"); + push(@tmp, "GPRINT:trans_" . $value_name . ":LAST:Current\\:" . $legend_labels[$n_smart] . "\\n"); } } else { if($show_current_values) { @@ -662,6 +685,9 @@ sub nvme_cgi { push(@tmp, "COMMENT: \\n"); push(@tmp, "COMMENT: \\n"); } + if ($n_plot < $main_smart_plots) { + $height *= 1.03; + } my @def_smart_average; my $cdef_smart_allvalues = "CDEF:allvalues="; @@ -682,12 +708,12 @@ sub nvme_cgi { $cdef_smart_allvalues .= ",0,GT,1,UNKN,IF"; } my @scaling_options; - if ($alt_axis_scaling[$n_smart]) { + if ($alt_axis_scaling[$n_plot]) { push(@scaling_options, "--alt-autoscale"); push(@scaling_options, "--alt-y-grid"); } - my $plot_title = $config->{graphs}->{'_nvme' . ($n_smart + 1)}; - $pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_smart_values_in_use + $n_smart], + my $plot_title = $config->{graphs}->{'_nvme' . ($n_plot + 1)}; + $pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_plots + $n_plot], "--title=$plot_title ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", "--imgformat=$imgfmt_uc", @@ -706,10 +732,10 @@ sub nvme_cgi { @CDEF, @tmp); $err = RRDs::error; - push(@output, "ERROR: while graphing $IMG_DIR" . $IMG[$e * $number_of_smart_values_in_use + $n_smart]. ": $err\n") if $err; + push(@output, "ERROR: while graphing $IMG_DIR" . $IMG[$e * $number_of_plots + $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 * $number_of_smart_values_in_use + $n_smart], + $picz = $rrd{$version}->("$IMG_DIR" . $IMGz[$e * $number_of_plots + $n_plot], "--title=$plot_title ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", "--imgformat=$imgfmt_uc", @@ -729,13 +755,13 @@ sub nvme_cgi { @CDEF, @tmpz); $err = RRDs::error; - push(@output, "ERROR: while graphing $IMG_DIR" . $IMGz[$e * $number_of_smart_values_in_use + $n_smart]. ": $err\n") if $err; + push(@output, "ERROR: while graphing $IMG_DIR" . $IMGz[$e * $number_of_plots + $n_plot]. ": $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 * $number_of_smart_values_in_use + $n_smart], IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n"); + push(@output, " " . picz_a_element(config => $config, IMGz => $IMGz[$e * $number_of_plots + $n_plot], IMG => $IMG[$e * $number_of_plots + $n_plot]) . "\n"); } else { if($version eq "new") { $picz_width = $picz->{image_width} * $config->{global_zoom}; @@ -744,10 +770,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 * $number_of_smart_values_in_use + $n_smart], IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n"); + push(@output, " " . picz_js_a_element(width => $picz_width, height => $picz_height, config => $config, IMGz => $IMGz[$e * $number_of_plots + $n_plot], IMG => $IMG[$e * $number_of_plots + $n_plot]) . "\n"); } } else { - push(@output, " " . img_element(config => $config, IMG => $IMG[$e * $number_of_smart_values_in_use + $n_smart]) . "\n"); + push(@output, " " . img_element(config => $config, IMG => $IMG[$e * $number_of_plots + $n_plot]) . "\n"); } } } From b9ba166adbef55637b97550fd93079fe7278fd6c Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:50:15 +0100 Subject: [PATCH 3/8] Fix plot arrangement and remove comments. --- lib/nvme.pm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 41d5102..050cf7c 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -131,10 +131,8 @@ sub measure { my $last_data_units_written = ($config->{nvme_hist}->{$k}->{$n}->{$data_units_written_identifier} || 0); my $data_units_written = $smart[$data_units_written_index]; $config->{nvme_hist}->{$k}->{$n}->{$data_units_written_identifier} = $data_units_written; -# logger("$myself: HUHU duw=". $data_units_written . ", lduw=".$last_data_units_written); if ($last_epoc ne 0 && $data_units_written >= $last_data_units_written) { $smart[$smartIndex] = ($data_units_written - $last_data_units_written) / ($epoc - $last_epoc); # Calculation of data units per seconds. -# logger("$myself: HUHU duw/s=". ($smart[$smartIndex] * 512000). " bytes/s"); } } if (defined($data_units_read_index)) { @@ -142,10 +140,8 @@ sub measure { my $last_data_units_read = ($config->{nvme_hist}->{$k}->{$n}->{$data_units_read_identifier} || 0); my $data_units_read = $smart[$data_units_read_index]; $config->{nvme_hist}->{$k}->{$n}->{$data_units_read_identifier} = $data_units_read; -# logger("$myself: HUHU dur=". $data_units_read . ", ldur=".$last_data_units_read); if ($last_epoc ne 0 && $data_units_read >= $last_data_units_read) { $smart[$smartIndex] = ($data_units_read - $last_data_units_read) / ($epoc - $last_epoc); # Calculation of data units per seconds. -# logger("$myself: HUHU dur/s=". ($smart[$smartIndex] * 512000). " bytes/s"); } } } @@ -513,7 +509,7 @@ sub nvme_cgi { # Array index is the plot index: my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 1, 1) : (0, 0, 0); - my @plot_order = $show_extended_plots ? (0, 8, 7, 1, 2, 4, 5, 3, 6) : (0, 1, 2); # To rearange the plots + my @plot_order = $show_extended_plots ? (0, 8, 7, 1, 2, 4, 5, 6, 3) : (0, 1, 2); # To rearange the plots my $main_smart_plots = $show_extended_plots ? 3 : 1; # Number of smart plots on the left side. my @main_plot_with_average = $show_extended_plots ? (1, 1, 1) : (1); # Wether or not the main plots show average, min and max or only the last value in the legend. From a9ffecbcf5c6955f5e565a0c5e43d5334ebb221e Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:10:08 +0100 Subject: [PATCH 4/8] Update config --- monitorix.conf | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/monitorix.conf b/monitorix.conf index 1fc9fa7..2d0c9ed 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -1088,7 +1088,7 @@ graph_name = system, kern, proc, hptemp, lmsens, gensens, ipmi, ambsens, amdgpu, nvidiagpu = NVIDIA GPU temperatures and usage nvidia = NVIDIA temperatures and usage disk = Disk drive temperatures and health - nvme = NVMe drive temperatures and health + nvme = NVMe drive health and load fs = Filesystem usage and I/O activity zfs = ZFS statistics du = Directory usage @@ -1179,12 +1179,15 @@ graph_name = system, kern, proc, hptemp, lmsens, gensens, ipmi, ambsens, amdgpu, _disk1 = Disk drives temperatures _disk2 = Reallocated sector count _disk3 = Current pending sector - _nvme1 = NVMe drives temperatures - _nvme2 = Spare capacity - _nvme3 = Life used - _nvme4 = Total written - _nvme5 = Media errors - _nvme6 = Unsafe shutdowns + _nvme1 = NVMe drives temperatures + _nvme2 = Mean read load + _nvme3 = Mean write load + _nvme4 = Spare capacity + _nvme5 = Life used + _nvme6 = Media errors + _nvme7 = Unsafe shutdowns + _nvme8 = Total read + _nvme9 = Total written _fs1 = Filesystems usage _fs2 = Disk I/O activity _fs3 = Inode usage From 7cfca7090a8a51f12ebd45d8310865a146f2928c Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Wed, 2 Feb 2022 09:13:03 +0100 Subject: [PATCH 5/8] Disable logarithmic axis scaling. --- lib/nvme.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 050cf7c..8a82acc 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -508,10 +508,11 @@ sub nvme_cgi { my @legend_labels = ("%5.1lf", "%4.0lf%%", "%4.0lf%%", $total_bytes_format, "%4.0lf%s", "%4.0lf%s", $total_bytes_format, $byte_speed_format, $byte_speed_format); # Array index is the plot index: - my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 1, 1) : (0, 0, 0); my @plot_order = $show_extended_plots ? (0, 8, 7, 1, 2, 4, 5, 6, 3) : (0, 1, 2); # To rearange the plots my $main_smart_plots = $show_extended_plots ? 3 : 1; # Number of smart plots on the left side. my @main_plot_with_average = $show_extended_plots ? (1, 1, 1) : (1); # Wether or not the main plots show average, min and max or only the last value in the legend. + my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 1, 1) : (0, 0, 0); + my @logarithmic_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 0, 0) : (0, 0, 0); if(!$show_extended_plots) { for(my $index = 0; $index < scalar(@plot_order); $index++) { @@ -537,6 +538,9 @@ sub nvme_cgi { if(scalar(@alt_axis_scaling) != $number_of_plots) { push(@output, "ERROR: Size of alt_axis_scaling (" . scalar(@alt_axis_scaling) . ") has to be equal to number_of_plots (" . $number_of_plots . ")"); } + if(scalar(@logarithmic_axis_scaling) != $number_of_plots) { + push(@output, "ERROR: Size of logarithmic_axis_scaling (" . scalar(@logarithmic_axis_scaling) . ") has to be equal to number_of_plots (" . $number_of_plots . ")"); + } if(scalar(@plot_order) > $number_of_smart_values_in_use) { push(@output, "ERROR: Size of plot_order (" . scalar(@plot_order) . ") has to be smaller or equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } @@ -708,6 +712,10 @@ sub nvme_cgi { push(@scaling_options, "--alt-autoscale"); push(@scaling_options, "--alt-y-grid"); } + if ($logarithmic_axis_scaling[$n_plot]) { + push(@scaling_options, "--logarithmic"); + @riglim = (); + } my $plot_title = $config->{graphs}->{'_nvme' . ($n_plot + 1)}; $pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_plots + $n_plot], "--title=$plot_title ($tf->{nwhen}$tf->{twhen})", From bb3a69b7bd87d16f9c948b64ae65cb763e6b6d1f Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Mon, 7 Feb 2022 09:50:39 +0100 Subject: [PATCH 6/8] Simplify riglim order. --- lib/nvme.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 8a82acc..daa2fd4 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -613,7 +613,7 @@ sub nvme_cgi { push(@output, " \n"); } my $n_smart = $plot_order[$n_plot]; - @riglim = @{setup_riglim($rigid[$n_smart], $limit[$n_smart])}; + @riglim = @{setup_riglim($rigid[$n_plot], $limit[$n_plot])}; undef(@tmp); undef(@tmpz); undef(@CDEF); From 4f2ae34a54ef91f9f891ee41811108944d894618 Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Thu, 10 Feb 2022 10:09:50 +0100 Subject: [PATCH 7/8] Make new nvme load plots optional. --- lib/nvme.pm | 58 ++++++++++++++++++++++----------------- man/man5/monitorix.conf.5 | 9 ++++++ monitorix.conf | 51 +++++++++++++++++----------------- 3 files changed, 68 insertions(+), 50 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index daa2fd4..5ac9d78 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -399,7 +399,16 @@ sub nvme_cgi { ); my $show_extended_plots = lc($nvme->{show_extended_plots} || "") eq "y" ? 1 : 0; - my $number_of_smart_values_in_use = $show_extended_plots ? 9 : 3; + my $show_more_extened_plots = lc($nvme->{show_more_extened_plots} || "") eq "y" ? 1 : 0; + my $number_of_smart_values_in_use = 3; + if ($show_more_extened_plots) { + $number_of_smart_values_in_use = 9; + } else { + if ($show_extended_plots) { + $number_of_smart_values_in_use = 6; + } + } + if($number_of_smart_values_in_use > $number_of_smart_values_in_rrd) { logger(@output, "ERROR: Number of smart values (" . $number_of_smart_values_in_use . ") has smaller or equal to number of smart values in rrd (" . $number_of_smart_values_in_rrd . ")!"); return; @@ -508,32 +517,34 @@ sub nvme_cgi { my @legend_labels = ("%5.1lf", "%4.0lf%%", "%4.0lf%%", $total_bytes_format, "%4.0lf%s", "%4.0lf%s", $total_bytes_format, $byte_speed_format, $byte_speed_format); # Array index is the plot index: - my @plot_order = $show_extended_plots ? (0, 8, 7, 1, 2, 4, 5, 6, 3) : (0, 1, 2); # To rearange the plots - my $main_smart_plots = $show_extended_plots ? 3 : 1; # Number of smart plots on the left side. - my @main_plot_with_average = $show_extended_plots ? (1, 1, 1) : (1); # Wether or not the main plots show average, min and max or only the last value in the legend. - my @alt_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 1, 1) : (0, 0, 0); - my @logarithmic_axis_scaling = $show_extended_plots ? (0, 0, 0, 0, 0, 0, 0, 0, 0) : (0, 0, 0); - - if(!$show_extended_plots) { - for(my $index = 0; $index < scalar(@plot_order); $index++) { - $y_axis_titles[$index] = $y_axis_titles[$plot_order[$index]]; - $value_transformations[$index] = $value_transformations[$plot_order[$index]]; - $legend_labels[$index] = $legend_labels[$plot_order[$index]]; + my @plot_order = (0, 1, 2); # To rearange the plots + my @main_plot_with_average = (1); # Wether or not the main plots show average, min and max or only the last value in the legend. + my @alt_axis_scaling = (0, 0, 0); + my @logarithmic_axis_scaling = (0, 0, 0); + if ($show_more_extened_plots) { + @plot_order = (0, 8, 7, 1, 2, 4, 5, 6, 3); + @main_plot_with_average = (1, 1, 1); + @alt_axis_scaling = (0, 0, 0, 0, 0, 0, 0, 1, 1); + @logarithmic_axis_scaling = (0, 0, 0, 0, 0, 0, 0, 0, 0); + } else { + if ($show_extended_plots) { + @plot_order = (0, 3, 1, 2, 4, 5); + @main_plot_with_average = (1, 0); + @alt_axis_scaling = (0, 0, 0, 1, 0, 0); + @logarithmic_axis_scaling = (0, 0, 0, 0, 0, 0); } - $#y_axis_titles = scalar(@plot_order)-1; - $#value_transformations = scalar(@plot_order)-1; - $#legend_labels = scalar(@plot_order)-1; } + my $main_smart_plots = scalar(@main_plot_with_average); # Number of smart plots on the left side. my $number_of_plots = scalar(@plot_order); - if(scalar(@y_axis_titles) != $number_of_smart_values_in_use) { - push(@output, "ERROR: Size of y_axis_titles (" . scalar(@y_axis_titles) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); + if(scalar(@y_axis_titles) < $number_of_smart_values_in_use) { + push(@output, "ERROR: Size of y_axis_titles (" . scalar(@y_axis_titles) . ") has to be >= number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } - if(scalar(@value_transformations) != $number_of_smart_values_in_use) { - push(@output, "ERROR: Size of value_transformations (" . scalar(@value_transformations) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); + if(scalar(@value_transformations) < $number_of_smart_values_in_use) { + push(@output, "ERROR: Size of value_transformations (" . scalar(@value_transformations) . ") has to be >= number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } - if(scalar(@legend_labels) != $number_of_smart_values_in_use) { - push(@output, "ERROR: Size of legend_labels (" . scalar(@legend_labels) . ") has to be equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); + if(scalar(@legend_labels) < $number_of_smart_values_in_use) { + push(@output, "ERROR: Size of legend_labels (" . scalar(@legend_labels) . ") has to be >= number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } if(scalar(@alt_axis_scaling) != $number_of_plots) { push(@output, "ERROR: Size of alt_axis_scaling (" . scalar(@alt_axis_scaling) . ") has to be equal to number_of_plots (" . $number_of_plots . ")"); @@ -544,9 +555,6 @@ sub nvme_cgi { if(scalar(@plot_order) > $number_of_smart_values_in_use) { push(@output, "ERROR: Size of plot_order (" . scalar(@plot_order) . ") has to be smaller or equal to number_of_smart_values_in_use (" . $number_of_smart_values_in_use . ")"); } - if(scalar(@main_plot_with_average) != $main_smart_plots) { - push(@output, "ERROR: Size of main_plot_with_average (" . scalar(@main_plot_with_average) . ") has to be equal to main_smart_plots (" . $main_smart_plots . ")"); - } for($n = 0; $n < keys(%{$nvme->{list}}); $n++) { for($n2 = 0; $n2 < $number_of_plots; $n2++) { @@ -716,7 +724,7 @@ sub nvme_cgi { push(@scaling_options, "--logarithmic"); @riglim = (); } - my $plot_title = $config->{graphs}->{'_nvme' . ($n_plot + 1)}; + my $plot_title = $config->{graphs}->{'_nvme' . ($n_smart + 1)}; $pic = $rrd{$version}->("$IMG_DIR" . $IMG[$e * $number_of_plots + $n_plot], "--title=$plot_title ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index d828ec7..247f67f 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -2082,6 +2082,15 @@ Show additional plots for total bytes written, media errors and unsafe shutdowns .P Default value: \fIy\fP .RE +.P +.BI show_more_extened_plots +.RS +.P +Show additional plots for mean read and written bytes per second, total bytes read and written, media errors and unsafe shutdowns. If set \fIshow_extended_plots\fP will be ignored. +.P +Default value: \fIn\fP +.RE + .P .BI show_current_values .RS diff --git a/monitorix.conf b/monitorix.conf index 2d0c9ed..a23f455 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -397,22 +397,23 @@ secure_log_date_format = %b %e # NVMe graph # ----------------------------------------------------------------------------- - - 0 = /dev/nvme0 - - rigid = 0, 0, 0, 0, 0, 0 - limit = 10, 100, 100, 100, 100, 100 - show_extended_plots = y - - availspare_enabled = n - availspare_timeintvl = 0 - availspare_threshold = 10 - availspare_script = /path/to/script.sh - percentused_enabled = n - percentused_timeintvl = 0 - percentused_threshold = 90 - percentused_script = /path/to/script.sh - + + 0 = /dev/nvme0 + + rigid = 0, 0, 0, 0, 0, 0, 0, 0, 0 + limit = 10, 100, 100, 100, 100, 100, 100, 100, 100 + show_extended_plots = y + show_more_extened_plots = n + + availspare_enabled = n + availspare_timeintvl = 0 + availspare_threshold = 10 + availspare_script = /path/to/script.sh + percentused_enabled = n + percentused_timeintvl = 0 + percentused_threshold = 90 + percentused_script = /path/to/script.sh + @@ -1088,7 +1089,7 @@ graph_name = system, kern, proc, hptemp, lmsens, gensens, ipmi, ambsens, amdgpu, nvidiagpu = NVIDIA GPU temperatures and usage nvidia = NVIDIA temperatures and usage disk = Disk drive temperatures and health - nvme = NVMe drive health and load + nvme = NVMe drive temperatures and health fs = Filesystem usage and I/O activity zfs = ZFS statistics du = Directory usage @@ -1180,14 +1181,14 @@ graph_name = system, kern, proc, hptemp, lmsens, gensens, ipmi, ambsens, amdgpu, _disk2 = Reallocated sector count _disk3 = Current pending sector _nvme1 = NVMe drives temperatures - _nvme2 = Mean read load - _nvme3 = Mean write load - _nvme4 = Spare capacity - _nvme5 = Life used - _nvme6 = Media errors - _nvme7 = Unsafe shutdowns - _nvme8 = Total read - _nvme9 = Total written + _nvme2 = Spare capacity + _nvme3 = Life used + _nvme4 = Total written + _nvme5 = Media errors + _nvme6 = Unsafe shutdowns + _nvme7 = Total read + _nvme8 = Mean write load + _nvme9 = Mean read load _fs1 = Filesystems usage _fs2 = Disk I/O activity _fs3 = Inode usage From e252e8f6ffba604e9042d7f7217ff59690c7af8c Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Sat, 19 Feb 2022 00:17:28 +0100 Subject: [PATCH 8/8] Remove show_more_extened_plots config option. It is now default. --- lib/nvme.pm | 20 ++------------------ man/man5/monitorix.conf.5 | 11 +---------- monitorix.conf | 1 - 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 5ac9d78..19f145e 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -399,16 +399,7 @@ sub nvme_cgi { ); my $show_extended_plots = lc($nvme->{show_extended_plots} || "") eq "y" ? 1 : 0; - my $show_more_extened_plots = lc($nvme->{show_more_extened_plots} || "") eq "y" ? 1 : 0; - my $number_of_smart_values_in_use = 3; - if ($show_more_extened_plots) { - $number_of_smart_values_in_use = 9; - } else { - if ($show_extended_plots) { - $number_of_smart_values_in_use = 6; - } - } - + my $number_of_smart_values_in_use = $show_extended_plots ? 9 : 3; if($number_of_smart_values_in_use > $number_of_smart_values_in_rrd) { logger(@output, "ERROR: Number of smart values (" . $number_of_smart_values_in_use . ") has smaller or equal to number of smart values in rrd (" . $number_of_smart_values_in_rrd . ")!"); return; @@ -521,18 +512,11 @@ sub nvme_cgi { my @main_plot_with_average = (1); # Wether or not the main plots show average, min and max or only the last value in the legend. my @alt_axis_scaling = (0, 0, 0); my @logarithmic_axis_scaling = (0, 0, 0); - if ($show_more_extened_plots) { + if ($show_extended_plots) { @plot_order = (0, 8, 7, 1, 2, 4, 5, 6, 3); @main_plot_with_average = (1, 1, 1); @alt_axis_scaling = (0, 0, 0, 0, 0, 0, 0, 1, 1); @logarithmic_axis_scaling = (0, 0, 0, 0, 0, 0, 0, 0, 0); - } else { - if ($show_extended_plots) { - @plot_order = (0, 3, 1, 2, 4, 5); - @main_plot_with_average = (1, 0); - @alt_axis_scaling = (0, 0, 0, 1, 0, 0); - @logarithmic_axis_scaling = (0, 0, 0, 0, 0, 0); - } } my $main_smart_plots = scalar(@main_plot_with_average); # Number of smart plots on the left side. my $number_of_plots = scalar(@plot_order); diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index 247f67f..df23ab0 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -2078,19 +2078,10 @@ Default value: \fIn\fP .BI show_extended_plots .RS .P -Show additional plots for total bytes written, media errors and unsafe shutdowns. +Show additional plots for mean read and written bytes per second, total bytes read and written, media errors and unsafe shutdowns .P Default value: \fIy\fP .RE -.P -.BI show_more_extened_plots -.RS -.P -Show additional plots for mean read and written bytes per second, total bytes read and written, media errors and unsafe shutdowns. If set \fIshow_extended_plots\fP will be ignored. -.P -Default value: \fIn\fP -.RE - .P .BI show_current_values .RS diff --git a/monitorix.conf b/monitorix.conf index a23f455..a8ceb65 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -403,7 +403,6 @@ secure_log_date_format = %b %e rigid = 0, 0, 0, 0, 0, 0, 0, 0, 0 limit = 10, 100, 100, 100, 100, 100, 100, 100, 100 show_extended_plots = y - show_more_extened_plots = n availspare_enabled = n availspare_timeintvl = 0