You don't need to monitor the S.M.A.R.T. status of the hard disks that are connected behind the RAID controller unless you want to make some statistical information. The RAID controller monitor all pre-fail status of the disks that are attached to it.
Regarding the monitoring of the RAID Volume you have several options depending of your needs.
1. No monitoring at all
2. Local Periodic checks (logs,dmesg, status commands etc)
3. Periodic reports by mail (using
cron(8) and
periodic(8) script)
4. Instant report by mail when the event occur (using
syslogd (8)with logging subprocess) or with monitoring the log file for changes using
tail(1)
Here is the example script for periodic daily reports. Save the script under /usr/local/etc/periodic/daily/
Bash:
#!/bin/sh
#
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
case "$daily_status_camcontrol_enable" in
[Yy][Ee][Ss])OD
echo
echo 'Checking status of camcontrol(8) devices:'
if camcontrol devlist; then
components="$(camcontrol devlist | grep -v ok)"
if [ "${components}" ]; then
rc=3
else
rc=0
fi
else
rc=2
fi
;;
*) rc=0;;
esac
exit $rc
Edit
/etc/periodic.conf.local and add:
daily_status_camcontrol_enable="YES"
If you want to receive immediately the the event when it occur you need to pipe the output line from syslogd which read the
/dev/klog
kernel messages and write them in corespondent file configured in
/etc/syslog.conf So you can pipe line this output in shell script for filtering then send it by mail. This can be dangerous of flooding the e-mail with messages if it's not filtered/configured correctly.
Here is the example script/configuration that can be made in single line in the syslog.conf or with shell script.
This script filter the output of kernel messages for keywords of the ciss driver for raid volume status and if there's match then send this message via mail to root. The same technique may be used for another messages if you know the status that are send by the raid driver.
/usr/local/etc/syslog_mail.sh
Bash:
#!/bin/sh
while IFS= read line; do
if [ "$(echo $line|tr [:upper:] [:lower:]|egrep 'rea|int|exp|rec|fai')" == "" ];
then :;
else echo "$line" | /usr/bin/mail -s SYSLOG root;
fi
done
We can grab all ciss driver messages with
Bash:
#!/bin/sh
while IFS= read line; do
if [ "$(echo $line|tr [:upper:] [:lower:]|grep 'ciss')" == "" ];
then :;
else echo "$line" | /usr/bin/mail -s SYSLOG root;
fi
done
It depend under which facility the message of the raid driver report the status. If it's under kern.warning or *.emerg then we can add the second line to pipe and filter the output
/etc/syslog.conf
Code:
*.err;kern.warning;*.emerg | /usr/local/etc/syslog_mail.sh
Or we can write it in single line into it the
/etc/syslog.conf
Code:
*.err;kern.warning;*.emerg | while read log; do if [ "$(echo $log|tr [:upper:] [:lower:]|egrep 'rea|int|exp|rec|fai')" == "" ]; then :; else echo "$log" | /usr/bin/mail -s SYSLOG root;fi done