From 6735d79b585d49943b6998771485e876b8adf604 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 11 Oct 2014 11:25:58 -0700 Subject: [PATCH] Show normalized values too --- smart-status/index.cgi | 3 ++- smart-status/lang/en | 1 + smart-status/smart-status-lib.pl | 2 +- smart-status/status_monitor.pl | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/smart-status/index.cgi b/smart-status/index.cgi index 5b57c109f..6d9616fa0 100755 --- a/smart-status/index.cgi +++ b/smart-status/index.cgi @@ -118,7 +118,8 @@ if ($config{'attribs'} && @{$st->{'attribs'}}) { foreach my $a (@{$st->{'attribs'}}) { next if ($a->[0] =~ /UDMA CRC Error Count/i); # too long print &ui_table_row($a->[0], - $a->[2] =~ /^\s*(seconds|minutes|hours|days|months|years|weeks)\s*/i || !$a->[2] ? $a->[1]." ".$a->[2] : $a->[2]); + ($a->[2] =~ /^\s*(seconds|minutes|hours|days|months|years|weeks)\s*/i || !$a->[2] ? $a->[1]." ".$a->[2] : $a->[2]). + ($a->[3] ? " ($text{'index_norm'} $a->[3])" : "")); } print &ui_hidden_table_end(); } diff --git a/smart-status/lang/en b/smart-status/lang/en index 85ff4b918..2c44235c4 100644 --- a/smart-status/lang/en +++ b/smart-status/lang/en @@ -24,6 +24,7 @@ index_return=module index index_family=Model family index_serial=Serial number index_capacity=Capacity +index_norm=Normalized: monitor_type=SMART Drive Check monitor_type2=SSD Wearout diff --git a/smart-status/smart-status-lib.pl b/smart-status/smart-status-lib.pl index 05518eee7..dd4b70f1a 100755 --- a/smart-status/smart-status-lib.pl +++ b/smart-status/smart-status-lib.pl @@ -350,7 +350,7 @@ if ($config{'attribs'}) { elsif (/^\s*(\d+)\s+(\S+)\s+(0x\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) { # A new-style vendor attribute $doneknown = 1; - push(@attribs, [ $2, $10, $4 ]); + push(@attribs, [ $2, $10, undef, $4 ]); $attribs[$#attribs]->[0] =~ s/_/ /g; } elsif (/^(\S.*\S):\s+\(\s*(\S+)\)\s*(.*)/ && !$doneknown) { diff --git a/smart-status/status_monitor.pl b/smart-status/status_monitor.pl index ff6bfce4a..6cb37cbf4 100755 --- a/smart-status/status_monitor.pl +++ b/smart-status/status_monitor.pl @@ -50,14 +50,14 @@ if ($type eq "wearout") { return { 'up' => -1, 'desc' => $text{'monitor_nowearout'} }; } - if ($wo->[2] < $mon->{'wearlevel'}) { + if ($wo->[3] < $mon->{'wearlevel'}) { return { 'up' => 0, - 'desc' => &text('monitor_wornout', $wo->[2]), - 'value' => $wo->[2] }; + 'desc' => &text('monitor_wornout', $wo->[3]), + 'value' => $wo->[3] }; } else { return { 'up' => 1, - 'value' => $wo->[2] }; + 'value' => $wo->[3] }; } } else {