[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RebuildXX event on mdadm



Hi all!

I'm using a bash script to extend the notification of events on mdadm:

# cat /etc/mdadm/mdadm.conf:
(...)
PROGRAM /usr/local/scripts/monitorRaidv2.sh


But it seems that mdadm does not trigger the RebuildXX events.

This is the portion of the script:

-----------------------------------------------------------------------
#
# Functions
#

# Compases a rebuild message
#
# Param 1: Percent complete
# Param 2: Device affected

rebuild_message() {
    $APP_CAT >$MESSAGE <<EOF
This is an automatically generated e-mail from the RAID administration
software running on `hostname`,

The RAID array $2 has completed $1% of its rebuild.
EOF
}

#
# Main
#

case $RAID_EVENT in

(...)

Rebuild20)
     $APP_ECHO -e "[`$APP_DATE +%d/%b/%Y:%T`] | $RAID_EVENT" >> $LOG_DIR/$LOG_FILE
     rebuild_message 20 $2
     ;;

Rebuild40)
     $APP_ECHO -e "[`$APP_DATE +%d/%b/%Y:%T`] | $RAID_EVENT" >> $LOG_DIR/$LOG_FILE
     rebuild_message 40 $2
     ;;

Rebuild60)
     $APP_ECHO -e "[`$APP_DATE +%d/%b/%Y:%T`] | $RAID_EVENT" >> $LOG_DIR/$LOG_FILE
     rebuild_message 60 $2
     ;;

Rebuild80)
     $APP_ECHO -e "[`$APP_DATE +%d/%b/%Y:%T`] | $RAID_EVENT" >> $LOG_DIR/$LOG_FILE
     rebuild_message 80 $2
     ;;

(...)

esac

for MAIL in $ADMIN_MAIL; do
  $APP_CAT $MESSAGE |mail -s "[$HOSTNAME] RAID $1 Event" $MAIL
done

-----------------------------------------------------------------------

Nor do I see the event to be logged in the syslog or alternative log
showing in the previous code. After simulating a disk failure, these
events are logged:

[16/jun/2014:18:54:14] | Fail
[16/jun/2014:19:38:50] | RebuildStarted
[16/jun/2014:19:39:11] | RebuildFinished
[16/jun/2014:19:39:11] | SpareActive

I am using Debian GNU/Linux Wheezy with mdadm 3.2.5-5 from Debian 
repositories.

I'm missing some additional configuration for the RebuildXX 
event is triggered?


Thanks in advance for your replies.

Best regards,
Daniel


Reply to: