Tuesday, May 5, 2009

ZFS Alerting

http://en.wikibooks.org/wiki/System_Monitoring_with_Hobbit/HOWTO#Hobbit_Client_and_ZFS_monitoring

Check which disk are in the system and ID’s given by Solaris:
bash-3.00# metastat |tail -3
Device Reloc Device ID
c0t1d0 Yes id1,sd@SSEAGATE_ST336607LSUN36G_3JA6ECDF00007418PJ5V
c0t0d0 Yes id1,sd@SSEAGATE_ST336607LSUN36G_3JA6EGFK00007418A7PM
bash-3.00#

bash-3.00# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1c,600000/scsi@2/sd@0,0
1. c0t1d0
/pci@1c,600000/scsi@2/sd@1,0
2. c0t2d0
/pci@1c,600000/scsi@2/sd@2,0
3. c0t3d0
/pci@1c,600000/scsi@2/sd@3,0


Show Health
# bash-3.00# zpool list -H
# mypool 33.8G 84.5K 33.7G 0% ONLINE -
# bash-3.00#


Script that sends an email out to redalert
This the script (run as root via crontab) I use to have an email sent
to 'root' if a fault is detected. It has already reported a fault:

#!/bin/sh
REPORT=/tmp/faultreport.txt
SYSTEM=$1
rm -f $REPORT
/usr/sbin/fmadm faulty 2>&1 > $REPORT
if test -s $REPORT
then
/usr/bin/Mail -s "$SYSTEM Fault Alert" redalert < $REPORT
fi
rm -f $REPORT