The Promise Pegasus2 has onboard sensors that monitor the power supply voltages, speed of the fan, and temperature of the controller and backplane.

This seems worth performing the occasional check on.

The example script below runs an initial check of the enclosure using promiseutil. If it doesn’t find that “Everything is OK”, it runs a more verbose check, logs the problem and optionally sends email.

#!/bin/bash # # promise_enclosure_check.sh # # Checks the status of a Promise Pegasus2 RAID enclosure and mails the output if there's an issue. # # Author: AB @ Modest Industries # # Works with Promise Utility for Pegasus2 v3.18.0000.18 (http://www.promise.com) # Requires sendemail for email alerts (http://caspian.dotconf.net/menu/Software/SendEmail/) # # Edit History # 2014-04-21 - AB: Version 1.0. # 2014-05-08 - AB: Refinements. # 2014-05-09 - AB: Better message_body if failed. export DATESTAMP=`date +%Y-%m-%d\ %H:%M:%S` # Editable variables # Path to sendemail sendemail_path="/Library/Scripts/Monitoring/sendemail" # If a problem is found, send email? send_email_alert=true # Variables for sendemail # Sender's address alert_sender="[email protected]" # Recipient's addresses, comma separated. #alert_recipient='[email protected], [email protected]' alert_recipient="[email protected]" # SMTP server to send the messages through alert_smtp_server="smtp.example.com" # ------------ Do not edit below this line ------------------ # Variables # Pass / fail flags enclosure_pass=true # The subject line of the alert. alert_subject="Alert: Promise Pegasus2 enclosure problem detected on $HOSTNAME." # Alert header alert_header="At $DATESTAMP, an enclosure problem was detected on this device:

" # Pass / Fail messages pass_msg="Promise Pegasus Enclosure check successful." fail_msg=" *** Promise Pegasus Enclosure check FAILED!!! ***



" # Alert footer alert_footer="Run 'promiseutil -C enclosure -v' for more information." # Create temp files unit_ID_tmp=`mktemp "/tmp/$$_unit_ID.XXXX"` enclosure_results_tmp=`mktemp "/tmp/$$_enclosure_results.XXXX"` message_body="$alert_header" # Get the information for this Promise unit. Includes workaround for promiseutil tty issue. screen -D -m sh -c "promiseutil -C subsys -v >$unit_ID_tmp" # Drop the output into a variable. unit_ID=$(<$unit_ID_tmp) # Get the report, put it into a tmp file. screen -D -m sh -c "promiseutil -C enclosure >$enclosure_results_tmp" if ! grep -qv "Everything is OK" $enclosure_results_tmp then enclosure_pass="false" # Get a more detailed report, put it into a tmp file. screen -D -m sh -c "promiseutil -C enclosure -v >$enclosure_results_tmp" # Build the message. message_body=$message_body$fail_header$unit_ID$(<$enclosure_results_tmp) fi # ----------------- Logging & email ------------------ # Log the results, conditionally send email on failure. if [ "$enclosure_pass" == "false" ]; then message_body="$message_body



$alert_footer" echo "$DATESTAMP:



$message_body" >> /var/log/system.log if [ "$send_email_alert" == "true" ] ; then "$sendemail_path" -f $alert_sender -t $alert_recipient -u $alert_subject -m "$message_body" -s $alert_smtp_server fi else echo "$DATESTAMP: $pass_msg" >> /var/log/system.log fi # Cleanup rm -f rm -f $unit_ID_tmp $enclosure_results_tmp

The script was developed against a Promise Pegasus2. It hasn’t been tested with the earlier Promise Pegasus series.

2014-11-07 – Update: Merci to Stéphane Allain for catching a typo in the script.