forked from hummypkg/webif
Allow HD to collect disk stats.
This commit is contained in:
parent
a34a951a33
commit
97b24da0ed
@ -3,8 +3,6 @@
|
||||
source /mod/webif/lib/setup
|
||||
require system.class settings.class
|
||||
|
||||
if {[system model] eq "HD"} exit
|
||||
|
||||
set disk [system disk]
|
||||
set settings [settings]
|
||||
|
||||
@ -20,7 +18,10 @@ if {$line ne ""} {
|
||||
}
|
||||
|
||||
# Extract disk model.
|
||||
foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
|
||||
if {[catch {set msg [exec /bin/smartctl -i $disk]}]} {
|
||||
set msg ""
|
||||
}
|
||||
foreach line [split $msg "\n"] {
|
||||
if {[string match "*Not in smartctl database*" $line]} continue
|
||||
if {[string match "*: *" $line]} {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
@ -31,7 +32,11 @@ foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
|
||||
}
|
||||
|
||||
# Extract disk attributes.
|
||||
foreach line [split [exec /bin/smartctl -A -f brief $disk] "\n"] {
|
||||
if {[catch {set msg [exec /bin/smartctl -A -f brief $disk]}]} {
|
||||
set msg ""
|
||||
}
|
||||
set attrs {}
|
||||
foreach line [split $msg "\n"] {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
regsub -all -- {^[[:space:]]+} $line "" line
|
||||
lassign [split $line] id name flags val worst thresh when rval
|
||||
|
Loading…
Reference in New Issue
Block a user