[Mon-commit] mon-contrib/monitors/raid softraid.monitor,NONE,1.1
Brought to you by:
trockij
|
From: Jim T. <tr...@us...> - 2005-06-03 12:39:59
|
Update of /cvsroot/mon/mon-contrib/monitors/raid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14923/monitors/raid Added Files: softraid.monitor Log Message: linux software raid monitor --- NEW FILE: softraid.monitor --- #!/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 # # Date: Thu, 07 Apr 2005 17:28:02 +0200 # From: Kevin Ivory <Iv...@Se...> # To: mo...@li... # Subject: Re: Monitoring software raid? # 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 |