added check for smart self assesment

This commit is contained in:
bluesaxman 2019-10-28 10:22:14 -06:00
parent da6cd39b4a
commit 97e3b5f41e

View File

@ -137,7 +137,12 @@ sub smartcheck {
# Do our smart disk thing...
my $diskid = shift;
my $disks = shift;
say"Checking S.M.A.R.T. variables...";
say "Checking overall-health self-assessment test result: ";
(my $smartassess = `smartctl /dev/sda -H | grep overall`) or (say "$!\ncould not check smart data, skipping" and return 1);
$disks->{$diskid}{smart}{selftest} = (split(": ", $smartassess))[1];
if ( "FAILED" == $disks->{$diskid}{smart}{selftest} ) { say "$color{red}Failed$color{reset}"; return 0
} else { say "$color{green}Passed$color{reset}\n"; }
say "Checking S.M.A.R.T. variables...";
# say qq(smartctl $disks->{$diskid}{path} -A -f hex,id | grep "^0x");
(my $smartcommand = `smartctl $disks->{$diskid}{path} -A -f hex,id | grep "^0x"`) or (say "$!\ncould not check smart data, skipping" and return 1);
for (split("\n",$smartcommand)) {