Skip to content
Snippets Groups Projects
Commit 6a9ea86e authored by Sergey Joseph Ivanov's avatar Sergey Joseph Ivanov
Browse files

improve Core::SMART module

parent 59554aa8
No related branches found
No related tags found
No related merge requests found
...@@ -106,10 +106,30 @@ sub handler { ...@@ -106,10 +106,30 @@ sub handler {
elsif ($line =~ /^Firmware Version:\s+(.+)$/) { elsif ($line =~ /^Firmware Version:\s+(.+)$/) {
$smartdata->{"fw"} = [$1, "s"]; $smartdata->{"fw"} = [$1, "s"];
} }
# Capture attribute_name, value, raw_value (columns 2,4,10) # Capture id, attribute_name, threshold, fail, raw_value (columns 1,2,6,7,8)
elsif ($line =~ /^\s*\d+\s(\S+)\s+\S+\s+(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)/) { =pod
$smartdata->{"$1"} = [$2, "i"]; Vendor Specific SMART Attributes with Thresholds:
$smartdata->{"$1_raw"} = [$3, "i"]; ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0004 137 137 000 Old_age Offline - 91
3 Spin_Up_Time 0x0007 120 120 024 Pre-fail Always - 317 (Average 313)
Per https://www.backblaze.com/blog/what-smart-stats-indicate-hard-drive-failures/,
we should check attributes:
ATTRIBUTE DESCRIPTION
SMART 5 Reallocated Sectors Count
SMART 187 Reported Uncorrectable Errors
SMART 188 Command Timeout
SMART 197 Current Pending Sector Count
SMART 198 Uncorrectable Sector Count
=cut
elsif ( ( $line =~ /^\s*(5|187|188|197|198)\s/ )
&& ($line =~ /^\s*(\d+)\s(\S+)\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+)/)
) {
$smartdata->{"$1_name"} = [$2, "s"];
$smartdata->{"$1_thresh"} = [$3, "i"];
$smartdata->{"$1_whenfailed"} = [$4, "s"];
$smartdata->{"$1_raw"} = [$5, "i"];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment