|
|
@@ -8,7 +8,7 @@ BEGIN { |
|
|
|
} |
|
|
|
|
|
|
|
function printdiskinfo(lblname, devname) { |
|
|
|
cmd = "smartctl -a /dev/" devname " | egrep '"'"'Temperature_Celsius|Airflow_Temperature_Cel|Device Model:|Power_On_Hours'"'"'" |
|
|
|
cmd = "smartctl -a /dev/" devname " | egrep '"'"'Temperature_Celsius|Airflow_Temperature_Cel|Device Model:|Power_On_Hours|Current_Pending_Sector|Offline_Uncorrectable'"'"'" |
|
|
|
r = cmd | getline |
|
|
|
#print "xfoox" r "x" $0 "xbarx" |
|
|
|
|
|
|
@@ -16,7 +16,7 @@ function printdiskinfo(lblname, devname) { |
|
|
|
hours = 0 |
|
|
|
temp = "unkn" |
|
|
|
if (r) { |
|
|
|
for (i = 0; i < 3; i++) { |
|
|
|
for (i = 0; i < 5; i++) { |
|
|
|
if ($1 == "Device" && $2 == "Model:") { |
|
|
|
$1 = "" |
|
|
|
$2 = "" |
|
|
@@ -25,6 +25,10 @@ function printdiskinfo(lblname, devname) { |
|
|
|
temp = $10 |
|
|
|
} else if ($2 == "Power_On_Hours") { |
|
|
|
hours = $10 |
|
|
|
} else if ($2 == "Current_Pending_Sector") { |
|
|
|
pending = $10 |
|
|
|
} else if ($2 == "Offline_Uncorrectable") { |
|
|
|
offline = $10 |
|
|
|
} |
|
|
|
r = cmd | getline |
|
|
|
} |
|
|
@@ -32,7 +36,7 @@ function printdiskinfo(lblname, devname) { |
|
|
|
close(cmd) |
|
|
|
|
|
|
|
years = sprintf("%.4g", ( hours / 24. / 365 )) |
|
|
|
print lblname "\t->\t" devname "\t->\t" disksize[devname] " TB\t->\t" years "\t" model "\t" temp |
|
|
|
print lblname "\t->\t" devname "\t->\t" disksize[devname] " TB\t->\t" years "\t" model "\t" temp "\t" pending "\t" offline |
|
|
|
delete disksize[devname] |
|
|
|
} |
|
|
|
|
|
|
|