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