Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Unified Diff: send_boot_metrics

Issue 6732024: Add SMART disk error counts to UMA (Closed) Base URL: http://git.chromium.org/git/init.git@master
Patch Set: Fix for dash Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: send_boot_metrics
diff --git a/send_boot_metrics b/send_boot_metrics
index cb209082ce75cb42b1bc5f83181ce55685b92a1e..bb626309b6fcf4eec6b6eddd5d58124271c8439c 100755
--- a/send_boot_metrics
+++ b/send_boot_metrics
@@ -35,3 +35,16 @@ report_disk_metrics $(
bootstat_get_last boot-complete read-sectors write-sectors)
send_metrics_on_resume -b
+
+# Report disk health from SMART (S.M.A.R.T.) parameters.
+# The first printf avoids a newline in $smart.
+smart="$(/usr/sbin/smartctl -A $(/usr/bin/rootdev -d) | \
+ awk '
+/^187/ { printf "%d ", $10; }
+/^199/ { print $10; }
+')"
+# smart now contains two numbers, for instance "10 20". Extract each number
+# using prefix and suffix substitutions. This would less cryptic if dash had
+# arrays.
+metrics_client Platform.SmartUncorrectableErrors ${smart% *} 1 1000000 20
+metrics_client Platform.SmartTransferErrors ${smart#* } 1 1000000 20
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698