Raid Controller check

Aus Bennys Wiki
Wechseln zu: Navigation, Suche

Script[Bearbeiten]

#!/bin/bash
# Script by Ansgar Sonntag <sonntag@inline.de>
# changelog: 
# v0.1 - basic script
#
# dependencies: 
#  3ware tw_cli
#  grep
#  awk
#  mutt


MAILTO="you@provider.xx"
TWCLI="/opt/tw_cli/tw_cli info c0 u0" # @see: tw_cli.8.html


TESTWERT='Ok'

for STATUS in `$TWCLI|grep ^u0|awk {'print $3'}`
  do
  if [ $STATUS = 'OK' ]
    then
    TESTWERT=$TESTWERT
  else
    TESTWERT=$STATUS
  fi
done
if [ $TESTWERT = 'Ok' ]
  # everything seems fine
  then
  exit 0
else
  # something is wrong - lets send a mail
  $TWCLI|mutt $MAILTO -s "RaidCheck Faild"
  exit 1
fi

crontab[Bearbeiten]

# m h  dom mon dow   command
*/16 * * * * /usr/local/bin/check_raid