#!/bin/sh # mpt-status monitoring wrapper # based on http://prefetch.net/reference/mpt-status.spec # NB: tested against a single SAS1068 HBA only export PATH=/bin:/usr/bin:/sbin:/usr/sbin MPT_ID= MPT_ARGS="-s" MPT_LOGLEVEL="kern.err" [ -s /etc/sysconfig/mpt-status ] && source /etc/sysconfig/mpt-status [ -n "$MAILTO" ] || exit 0 [ -n "$MPT_ID" ] && MPT_ARGS="$MPT_ARGS -i $MPT_ID" # The return code from mpt-status is a bit mask, and can be interepreted # according to the following table (current as of 1.2.0): # Bit Value Meaning # ----------------------------------------------------------------- # 0 1 Abnormal condition / unknown error # 1 2 A logical volume has failed # 2 4 A logical volume is degraded # 3 8 A logical volume is resyncing # 4 16 At least one physical disk failed # 5 32 At least one physical disk is in warning condition OUT="`mpt-status $MPT_ARGS`" || { echo -e "check mpt-status $MPT_ARGS on $HOSTNAME\n\n$OUT" | mail -s "[$HOSTNAME] mpt-status: disk failure" "$MAILTO" logger -p "$MPT_LOGLEVEL" "STORAGE ERROR: A failure was detected with the LSI Logic RAID controller or one of the disk drives" logger -p "$MPT_LOGLEVEL" "STORAGE ERROR: Run mpt-status to view the status of the storage subsystem" }