#!/bin/sh #******************************************************************************* # # NAME: %name% # SUMMARY: Initial RAID Manager event notification script for Unix systems. # COMPONENT: %subsystem% # VERSION: %version% # UPDATE DATE: %date_modified: % # # CONTACTS: # Originator: jgatica # Owner: ? # Backup: ? # Updater: %created_by: % # # Copyright 1995, 1996, 1997 by Symbios Logic Inc. # # DESCRIPTION: # This script is called by the RAID Manager application or daemon every time a # new event has been detected. The application creates an event record # and saves it in a file whose name is passed as the first argument to # this script. # # After initial installation, users may change this script to add or # remove features, such as mailing the superuser account, etc. # However, this script should always call putplog to update the # proprietary log (disabling of this can be done via the parameter # file), and it must delete the event file when it is done with it. # # # NOTES: # # # REFERENCE: # 1. PIP0003C.DOC, Source Code Integrity Measures # # # CODING STANDARD WAIVERS: # # #******************************************************************************* PATH=$PATH:/etc/raid/bin:/etc/raid/lib export PATH # Add the event to the proprietary log putplog $1 # Add the event to the syslog EVTYPE=`cut -d\~ -f6 $1` if [ EVTYPE != 30 ] then (case $EVTYPE in # An AEN event 00) awk -F\~ 'NF > 0 { printf "AEN event Host=%s Ctrl=%s Dev=%s\n ASC=%s ASCQ=%s FRU=%s LUN=%s LUN Stat=%s\n Sense=%s", $1, $2, $3, substr($7,1,2), substr($7,3,2), $8, $9, $10, $11 }' < $1;; # # Mode Page events are ignored for now 10) ;; # # Parity event 20) awk -F\~ 'NF > 0 { printf "Parity event Host=%s Ctrl=%s Dev=%s\n Start Blk=%s End Blk=%s # Blks=%s LUN=%s ", $1, $2, $3, $7, $8, $9, $10 }' < $1;; # # Text events are ignored for now 90) ;; # esac) | ( if [ -x "/usr/ucb/logger" ] then /usr/ucb/logger -t raid -p user.err elif [ -x "/usr/bin/logger" ] then /usr/bin/logger -t raid -p user.err fi ) # Mail the superuser that an event has occurred (awk -F\~ 'NF > 0 { printf "An array event has been detected on Controller %s \n Device %s at Host %s - Time %s %s\n", $2, $3, $1, $4, $5 }' < $1; echo "\nGo to the Message Log in the Status Application for details" ) | mailx -s "raid Event" root # If a network is available, does resolv.conf exist and is non-zero? if [ -s "/etc/resolv.conf" ] then case $EVTYPE in 00) cCode="`cut -d\~ -f7 $1`" cCode="`echo 0000$cCode`";; 20)cCode="`cut -d\~ -f11 $1`";; 90)cCode="`cut -d\~ -f11 $1`";; esac ctrlName="`cut -d\~ -f2 $1`" hostName="`cut -d \~ -f1 $1`" if [ -x "/usr/bin/getent" ] then hostIP="`getent hosts $hostName | awk '/^[0-9][0-9]*[.]/ {print $1}'`" else hostIP="`nslookup $hostName | grep Address | tail -1 | awk '{ print $2 }'" fi trapcntl $cCode $ctrlName $hostIP $hostName fi fi # Delete the event file (needed since arraymon does not do this) rm $1