OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) | 7 FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) |
8 AWK_PROG=' | 8 AWK_PROG=' |
9 /Initial TSC value:/ { | 9 /Initial TSC value:/ { |
10 sub(".*Initial TSC value: ", "") | 10 sub(".*Initial TSC value: ", "") |
(...skipping 17 matching lines...) Expand all Loading... |
28 # report_disk_metrics <read-sectors> <write-sectors> | 28 # report_disk_metrics <read-sectors> <write-sectors> |
29 report_disk_metrics() { | 29 report_disk_metrics() { |
30 metrics_client Platform.BootSectorsRead $1 1 1000000 50 | 30 metrics_client Platform.BootSectorsRead $1 1 1000000 50 |
31 metrics_client Platform.BootSectorsWritten $2 1 10000 50 | 31 metrics_client Platform.BootSectorsWritten $2 1 10000 50 |
32 } | 32 } |
33 | 33 |
34 report_disk_metrics $( | 34 report_disk_metrics $( |
35 bootstat_get_last boot-complete read-sectors write-sectors) | 35 bootstat_get_last boot-complete read-sectors write-sectors) |
36 | 36 |
37 send_metrics_on_resume -b | 37 send_metrics_on_resume -b |
| 38 |
| 39 # Report disk health from SMART (S.M.A.R.T.) parameters. |
| 40 # The first printf avoids a newline in $smart. |
| 41 smart="$(/usr/sbin/smartctl -A $(/usr/bin/rootdev -d) | \ |
| 42 awk ' |
| 43 /^187/ { printf "%d ", $10; } |
| 44 /^199/ { print $10; } |
| 45 ')" |
| 46 # smart now contains two numbers, for instance "10 20". Extract each number |
| 47 # using prefix and suffix substitutions. This would less cryptic if dash had |
| 48 # arrays. |
| 49 metrics_client Platform.SmartUncorrectableErrors ${smart% *} 1 1000000 20 |
| 50 metrics_client Platform.SmartTransferErrors ${smart#* } 1 1000000 20 |
OLD | NEW |