Don't error on null SMART status

This commit is contained in:
prpr 2022-04-24 17:37:13 +01:00
parent 97b24da0ed
commit b6c0ff80b6
1 changed files with 8 additions and 7 deletions

View File

@ -19,15 +19,15 @@ proc {system disksmarterror} {sa count ack_count} {
proc {system disksmart} {} {
set smartmsg ""
set smartattrs {realloc pending offline spinretry}
set smartattribs(SMART_status) "Unknown"
foreach sa $smartattrs {
set smartattribs(SMART_$sa) 0
set smartattribs(SMART_ack_$sa) 0
}
foreach line [[settings] smartdata] {
lassign $line x name x n x t
if {$name eq "SMART_status"} {
@ -36,15 +36,16 @@ proc {system disksmart} {} {
set smartattribs($name) $n
}
}
# (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7)
if {$smartattribs(SMART_status) ne "PASSED" &&
$smartattribs(SMART_status) ne "Unknown"} {
$smartattribs(SMART_status) ne "Unknown" &&
$smartattribs(SMART_status) ne ""} {
append smartmsg \
"Disk overall health assessment is: $smartattribs(SMART_status)\n"
}
foreach sa $smartattrs {
set count $smartattribs(SMART_$sa)
set ack_count $smartattribs(SMART_ack_$sa)