Hi Simon,
On 2005-04-05 12:49, Simon Detheridge wrote:
Has anyone come up with a monitor to keep an eye on linux software-raid status?
How about remote boxes? Presumably this would require some kind of snmp extension...
Does anyone have a working solution running for this?
The local check can be done by an extremely simple shell-script (the user executing it only needs to write a reference file once):
#!/bin/bash # softraid.monitor # Linux Software RAID check with mon compatible output/return values # Call without arguments. # The reference file $md_ref must exist. To generate it: # softraid.monitor learn # [ cat /proc/mdstat > /path/to/dir/mdstat.reference ] # no administrative permissions needed for this script. # Return values: 3 /proc/mdstat missing, no Software RAID? # 2 reference file missing # 1 RAID not okay # 0 alles okay
mdstat="/proc/mdstat"
# THIS NEEDS TO BE SOMEWHERE THE CHECKING USER CAN WRITE
md_ref="/var/something/mdstat.reference"
if [ ! -r "$mdstat" ]; then
echo -e "$HOSTNAME:$0
Missing RAID status file: $mdstat
Perhaps no software RAID?"
exit 3
fi
if [ "$1" = "learn" ]; then
cat "$mdstat" > "$md_ref"
fi
if [ ! -r "$md_ref" ]; then
echo -e "$HOSTNAME:$0
Missing RAID reference file: $md_ref
Generate with: $0 learn > $md_ref"
exit 2
fi
md_out="Complete contents of $mdstat:\n\n$(cat $mdstat)"
diff=$(diff -u -U 0 $md_ref $mdstat)
stat=$?
if [ $stat -eq 0 ]; then
echo -e "$HOSTNAME\nSoftware RAID ok:\n$md_out"
else
echo -e "$HOSTNAME\nSoftware RAID not ok:\n$diff\n\n$md_out"
exit 1
fi
# end of softraid.monitor
We realize remote checks with ssh private/public keys and forced commands and a separate shell script that loops over a whole bunch of remote hosts. (The biggest problem with this is that the ssh command does not timeout.)
Kevin -- _ | Kevin Ivory | Tel: +49-551-3700000 |_ |\ | | Service Network GmbH | Fax: +49-551-3700009 ._|ER | \|ET | Bahnhofsallee 1b | mailto:[EMAIL PROTECTED] Service Network | 37081 Goettingen | http://www.SerNet.de/
_______________________________________________ mon mailing list [email protected] http://linux.kernel.org/mailman/listinfo/mon
