root / plugins / disk / raid-mismatch-count @ a45257a6
Historique | Voir | Annoter | Télécharger (1,83 ko)
| 1 | ecd6f359 | Caius Durling | #!/bin/sh |
|---|---|---|---|
| 2 | # Detect and display Linux sw-raid mismatch count |
||
| 3 | # Copyright (C) 2011 Rory Jaffe <rsjaffe@gmail.com> |
||
| 4 | # derived from md_sync_speed by Kristian Lyngstøl |
||
| 5 | # Copyright (C) 2010 Kristian Lyngstøl <kristian@bohemians.org> |
||
| 6 | 17f78427 | Lars Kruse | # |
| 7 | ecd6f359 | Caius Durling | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
||
| 9 | # the Free Software Foundation; either version 2 of the License, or |
||
| 10 | # (at your option) any later version. |
||
| 11 | 17f78427 | Lars Kruse | # |
| 12 | ecd6f359 | Caius Durling | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 15 | # GNU General Public License for more details. |
||
| 16 | 17f78427 | Lars Kruse | # |
| 17 | ecd6f359 | Caius Durling | # You should have received a copy of the GNU General Public License along |
| 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
||
| 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
| 20 | ##### |
||
| 21 | 17f78427 | Lars Kruse | # |
| 22 | ecd6f359 | Caius Durling | # Magic Markers: |
| 23 | # #%# family=auto |
||
| 24 | # #%# capabilities=autoconf |
||
| 25 | |||
| 26 | |||
| 27 | 48d0a2e2 | Ken-ichi Mito | targets=`ls /sys/devices/virtual/block/*/md/mismatch_cnt 2> /dev/null | cut -d/ -f6` |
| 28 | ecd6f359 | Caius Durling | returnval=$? |
| 29 | |||
| 30 | if [ "x$1" = "xautoconf" ]; then |
||
| 31 | if [ -z "$targets" ]; then |
||
| 32 | echo "no (no md devices found under /sys/devices/virtual/block/*/md/mismatch_cnt)" |
||
| 33 | elif [ "x$returnval" != "x0" ]; then |
||
| 34 | echo "no (discovery of md devices failed strangely)" |
||
| 35 | else |
||
| 36 | echo "yes" |
||
| 37 | fi |
||
| 38 | e4cd049b | Lars Kruse | exit 0 |
| 39 | ecd6f359 | Caius Durling | fi |
| 40 | |||
| 41 | if [ "x$1" = "xconfig" ]; then |
||
| 42 | cat << __EOF__ |
||
| 43 | graph_title Software-raid mismatch count |
||
| 44 | graph_args -l 0 |
||
| 45 | graph_info Display mismatch count of software raid devices |
||
| 46 | graph_category disk |
||
| 47 | graph_vlabel Count |
||
| 48 | __EOF__ |
||
| 49 | for target in $targets; do |
||
| 50 | echo "$target.label $target" |
||
| 51 | b149f0cf | Thomas Riccardi | echo "$target.critical 1" |
| 52 | 370e1d05 | Thomas Riccardi | echo "$target.info Mismatch count for software raid device $target" |
| 53 | ecd6f359 | Caius Durling | done |
| 54 | exit |
||
| 55 | fi |
||
| 56 | |||
| 57 | for target in $targets; do |
||
| 58 | 48d0a2e2 | Ken-ichi Mito | echo $target.value $(cat /sys/devices/virtual/block/$target/md/mismatch_cnt) |
| 59 | ecd6f359 | Caius Durling | done |
