|
@@ -3,18 +3,24 @@ |
|
|
# | egrep $(zpool list -v ztank | grep label | awk 'BEGIN { j="" } { printf "%s%s", j, substr($1, 7, length($1) - 10); j="|" } END { print "" }' ) |
|
|
# | egrep $(zpool list -v ztank | grep label | awk 'BEGIN { j="" } { printf "%s%s", j, substr($1, 7, length($1) - 10); j="|" } END { print "" }' ) |
|
|
# state=0 parsing diskinfo |
|
|
# state=0 parsing diskinfo |
|
|
# state=1 parsing glabel |
|
|
# state=1 parsing glabel |
|
|
(diskinfo /dev/ada*[0-9]; glabel status) | awk -v state=0 ' |
|
|
|
|
|
|
|
|
(diskinfo $(ls /dev/ada*[0-9] | egrep '^/dev/ada[0-9]+$'); glabel status) | awk -v state=0 ' |
|
|
BEGIN { |
|
|
BEGIN { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function printdiskinfo(lblname, devname) { |
|
|
function printdiskinfo(lblname, devname) { |
|
|
cmd = "smartctl -a /dev/" devname " | egrep '"'"'Device Model|Power_On_Hours'"'"'" |
|
|
cmd = "smartctl -a /dev/" devname " | egrep '"'"'Device Model|Power_On_Hours'"'"'" |
|
|
cmd | getline |
|
|
|
|
|
$1 = "" |
|
|
|
|
|
$2 = "" |
|
|
|
|
|
model = $0 |
|
|
|
|
|
cmd | getline |
|
|
|
|
|
hours = $10 |
|
|
|
|
|
|
|
|
r = cmd | getline |
|
|
|
|
|
#print "xfoox" r "x" $0 "xbarx" |
|
|
|
|
|
if (r) { |
|
|
|
|
|
$1 = "" |
|
|
|
|
|
$2 = "" |
|
|
|
|
|
model = $0 |
|
|
|
|
|
cmd | getline |
|
|
|
|
|
hours = $10 |
|
|
|
|
|
} else { |
|
|
|
|
|
model = "unknown" |
|
|
|
|
|
hours = 0 |
|
|
|
|
|
} |
|
|
close(cmd) |
|
|
close(cmd) |
|
|
|
|
|
|
|
|
years = sprintf("%.4g", ( hours / 24. / 365 )) |
|
|
years = sprintf("%.4g", ( hours / 24. / 365 )) |
|
|