Last active
December 14, 2022 02:22
-
-
Save theAkito/d3ceb3ce35e4331c70babc2382a7578a to your computer and use it in GitHub Desktop.
Get most significant S.M.A.R.T. attribute data with Nu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs in Nushell. https://www.nushell.sh/ | |
# Replace `/dev/sda` with whatever drive you want to inspect. | |
# The `-d sat` option might vary in your case. | |
# Most of the time, you do not need this option, at all. | |
smartctl -ajd sat /dev/sda | from json | |
| get ata_smart_attributes.table | |
| select name raw | |
| rename -c [ raw count ] | |
| update cells -c [ count ] { |value| $value.value } | |
| where name =~ 'Reallocated_Sector_Ct|Current_Pending_Sector|Offline_Uncorrectable' | |
| insert status OK | |
| each { |row| | |
if $row.count > 0 { | |
$row | update status FAIL | |
} else { $row } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment