how to monitor a linux raid array

create a cron job:

  5 '// //' /sbin/mdadm --monitor --scan --mail=raidmon@example.com /dev/md0 -1

or directly, using /proc/mdstat:

  egrep '\[.*_.*\]' /proc/mdstat >/dev/null && exit 1 || exit 0