1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Strip hidden characters from raid-mismatch script

Seems to have windows line-endings and a hidden unicode (U+FEFF) character on the first line which stops it running for me.
This commit is contained in:
Caius Durling 2012-11-01 12:55:13 +00:00
parent a9ce052bff
commit ecd6f3599e

View file

@ -1,59 +1,59 @@
#!/bin/sh #!/bin/sh
# Detect and display Linux sw-raid mismatch count # Detect and display Linux sw-raid mismatch count
# Copyright (C) 2011 Rory Jaffe <rsjaffe@gmail.com> # Copyright (C) 2011 Rory Jaffe <rsjaffe@gmail.com>
# derived from md_sync_speed by Kristian Lyngstøl # derived from md_sync_speed by Kristian Lyngstøl
# Copyright (C) 2010 Kristian Lyngstøl <kristian@bohemians.org> # Copyright (C) 2010 Kristian Lyngstøl <kristian@bohemians.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., # with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
##### #####
# #
# Magic Markers: # Magic Markers:
# #%# family=auto # #%# family=auto
# #%# capabilities=autoconf # #%# capabilities=autoconf
targets=`ls /sys/devices/virtual/block/*/md/mismatch_cnt | cut -d/ -f6` targets=`ls /sys/devices/virtual/block/*/md/mismatch_cnt | cut -d/ -f6`
returnval=$? returnval=$?
if [ "x$1" = "xautoconf" ]; then if [ "x$1" = "xautoconf" ]; then
if [ -z "$targets" ]; then if [ -z "$targets" ]; then
echo "no (no md devices found under /sys/devices/virtual/block/*/md/mismatch_cnt)" echo "no (no md devices found under /sys/devices/virtual/block/*/md/mismatch_cnt)"
exit 1; exit 1;
elif [ "x$returnval" != "x0" ]; then elif [ "x$returnval" != "x0" ]; then
echo "no (discovery of md devices failed strangely)" echo "no (discovery of md devices failed strangely)"
exit 1; exit 1;
else else
echo "yes" echo "yes"
exit 0 exit 0
fi fi
fi fi
if [ "x$1" = "xconfig" ]; then if [ "x$1" = "xconfig" ]; then
cat << __EOF__ cat << __EOF__
graph_title Software-raid mismatch count graph_title Software-raid mismatch count
graph_args -l 0 graph_args -l 0
graph_info Display mismatch count of software raid devices graph_info Display mismatch count of software raid devices
graph_category disk graph_category disk
graph_vlabel Count graph_vlabel Count
__EOF__ __EOF__
for target in $targets; do for target in $targets; do
echo "$target.label $target" echo "$target.label $target"
done done
exit exit
fi fi
for target in $targets; do for target in $targets; do
echo $target.value $(cat /sys/devices/virtual/block/$target/md/sync_completed) echo $target.value $(cat /sys/devices/virtual/block/$target/md/sync_completed)
done done