Script de notification de problèmes sur une carte raid HP
Par pepin le jeudi, janvier 23 2014, 13:01 - Sécurité - Lien permanent
Ce script est basé sur l'outil hpacucli, et demande le script "sendmail.pl" (script perl d'envoi d'un mail via smpt, cf post précédent).
#!/bin/bash export PATH=$PATH:/sbin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin REPORT=/tmp/notify-raid-failure slots=`hpacucli ctrl all show detail 2>&1 | grep "^ *Slot:" | sort | uniq | awk -v FS=':' '{print $2}'` for slot in $slots do hpacucli ctrl slot=$slot show detail hpacucli ctrl slot=$slot pd all show hpacucli ctrl slot=$slot ld all show done > $REPORT grep Fail $REPORT && sendmail.pl -s "Raid Failure on `hostname`" -t notifications.alertes@devinci.interne < $REPORT