[SunHELP] Health Check scripts
Brad Blix
brad at cpinternet.com
Thu Feb 5 08:16:10 CST 2004
Here is the script I use. It gives most of what you are looking for and
you should be able to add what is missing fairly easily.
Brad
#!/bin/sh
HOST=`/bin/hostname`
MANAGER="you at yourdomain.com"
NOW=`/bin/date`
LOG="/tmp/dailystatus"
MOUNTPOINT="/usr/local/tripwire"
CDDEVICE="/dev/dsk/c0t6d0s2"
/bin/echo "$HOST Daily Status $NOW" > $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
/bin/echo "********** Login History **********" >> $LOG
/bin/echo >> $LOG
last | head -25 >> $LOG
/bin/echo >> $LOG
/bin/echo "********** Auth Log **********" >> $LOG
/bin/echo >> $LOG
tail -25 /var/log/authlog >> $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
/bin/echo "********** Disk Space **********" >> $LOG
/bin/echo >> $LOG
/bin/echo "Filesystem kbytes used avail capacity
Mounted on" >> $LOG
/bin/df -k | /bin/grep /dsk/ >> $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
if [ -f /usr/platform/`uname -i`/sbin/prtdiag ]; then
/bin/echo "********** System Hardware Status **********" >> $LOG
/bin/echo >> $LOG
/usr/platform/`uname -i`/sbin/prtdiag -v >> $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
fi
if [ -f /etc/lvm/md.tab ]; then
/bin/echo "********** Disk Suite Disk Status **********" >> $LOG
/bin/echo >> $LOG
/usr/sbin/metastat >> $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
fi
if [ -f /etc/lvm/md.tab ]; then
/bin/echo "********** Disk Suite Meta-db Status **********" >>
$LOG
/bin/echo >> $LOG
/usr/sbin/metadb -i >> $LOG
/bin/echo >> $LOG
/bin/echo >> $LOG
fi
mount -F hsfs $CDDEVICE $MOUNTPOINT
if [ ! -f $MOUNTPOINT/tripwire ] ; then
mailx -s "$HOST Cannot Mount Tripwire" $MANAGER
exit
fi
cd $MOUNTPOINT
/bin/echo "********** TripWire Report **********" >> $LOG
/bin/echo >> $LOG
$MOUNTPOINT/tripwire >> $LOG
cd /
umount $MOUNTPOINT
/usr/bin/mailx -s "[Daily Status] $HOST - $NOW" $MANAGER < $LOG
sleep 60
rm $LOG
More information about the SunHELP
mailing list