Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / disk / raid-mismatch-count @ a45257a6

Historique | Voir | Annoter | Télécharger (1,83 ko)

1
#!/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
#
7
# 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
#
12
# 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
#
17
# 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
#
22
# Magic Markers:
23
# #%# family=auto
24
# #%# capabilities=autoconf
25

    
26

    
27
targets=`ls /sys/devices/virtual/block/*/md/mismatch_cnt 2> /dev/null | cut -d/ -f6`
28
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
	exit 0
39
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
		echo "$target.critical 1"
52
		echo "$target.info Mismatch count for software raid device $target"
53
	done
54
	exit
55
fi
56

    
57
for target in $targets; do
58
	echo $target.value $(cat /sys/devices/virtual/block/$target/md/mismatch_cnt)
59
done