From c87fe89db48233f1f53da2208de712c7d4b17c4e Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Mon, 11 Oct 2021 16:09:38 +0200 Subject: [PATCH] Add use_nan_for_missing_data to nvme.pm --- lib/nvme.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nvme.pm b/lib/nvme.pm index 4ea1c0a..0b63184 100644 --- a/lib/nvme.pm +++ b/lib/nvme.pm @@ -189,6 +189,7 @@ 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 $temp; my @smart; @@ -200,8 +201,8 @@ sub nvme_update { # values delimitted by ", " (comma + space) my @dsk = split(', ', $nvme->{list}->{$k}); for($n = 0; $n < $max_number_of_hds; $n++) { - $temp = 0; - @smart = (0) x $max_number_of_smart_values_in_rrd; + $temp = $use_nan_for_missing_data ? (0+"nan") : 0; + @smart = ($use_nan_for_missing_data ? (0+"nan") : 0) x $max_number_of_smart_values_in_rrd; if($dsk[$n]) { my $d = trim($dsk[$n]);