Projet

Général

Profil

Révision dd8bf640

IDdd8bf640883be99903a923fb85dc5a832215a222
Parent 203f993d
Enfant 078fb31f

Ajouté par Rory Jaffe il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/raid-mismatch-count
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 | 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
		exit 1;
34
	elif [ "x$returnval" != "x0" ]; then
35
		echo "no (discovery of md devices failed strangely)"
36
		exit 1;
37
	else
38
		echo "yes"
39
		exit 0
40
	fi
41
fi
42

  
43
if [ "x$1" = "xconfig" ]; then
44
	cat << __EOF__
45
graph_title Software-raid mismatch count
46
graph_args -l 0
47
graph_info Display mismatch count of software raid devices
48
graph_category disk
49
graph_vlabel Count
50
__EOF__
51
	for target in $targets; do
52
		echo "$target.label $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/sync_completed)
59
done

Formats disponibles : Unified diff