Dell OpenManage Email Alerts (Bash)

If you are running Dell OpenManage on Ubuntu 12.04 as I previously detailed, then chances are you would also like to automate alerts via email. Since Dell OpenManage does not natively support e-mails we will need to turn to our trusty bash script in order to accomplish this task. The only requirement for my script would be to pass the alert type to the email.  Below is the basic script.

#!/bin/sh
#----------------------------------#
#    Created by Matthew Marable    #
#    Dell OpenMange Email Alert    #
#----------------------------------#
echo "There has been an OpenManage [$1] detected on SERVERNAME.  Please login to the web interface to see details." | mail -s "SERVERNAME Server Alert!" -a "From: SERVERNAME Automation <postmaster@youremail.com>" admin@youremail.com,admin2@youremail.net

The script above is pretty simple. It only takes on input that will be loaded into the $1, this is the alert variable. In order to use the script, ensure it is located at the path /usr/local/bin/om-alert.sh and is made executable with the following command: chmod +x /usr/local/bin/om-alert.sh. Once the script is executable, it can be tested with the following command:

/usr/local/bin/om-alert.sh 'Message For Alert'

Once you have confirmed that the om-alert.sh script works, you can set the alert actions using the below script I have name set-om-alerts.sh. Note that messages such as “battery probe warning” can be changed to whatever you want.

omconfig system alertaction event=batterywarn execappath='/usr/local/bin/om-alert.sh "battery probe warning"'
omconfig system alertaction event=batteryfail execappath='/usr/local/bin/om-alert.sh "battery probe failure"'
omconfig system alertaction event=fanwarn execappath='/usr/local/bin/om-alert.sh "fan probe warning"'
omconfig system alertaction event=fanfail execappath='/usr/local/bin/om-alert.sh "fan probe failure"'
omconfig system alertaction event=hardwarelogwarn execappath='/usr/local/bin/om-alert.sh "hardware log warning"'
omconfig system alertaction event=hardwarelogfull execappath='/usr/local/bin/om-alert.sh "hardware log failure"'
omconfig system alertaction event=intrusion execappath='/usr/local/bin/om-alert.sh "chassis intrusion detected"'
omconfig system alertaction event=memprefail execappath='/usr/local/bin/om-alert.sh "memory prefailure"'
omconfig system alertaction event=memfail execappath='/usr/local/bin/om-alert.sh "memory failure"'
omconfig system alertaction event=systempowerwarn execappath='/usr/local/bin/om-alert.sh "system power warning"'
omconfig system alertaction event=systempowerfail execappath='/usr/local/bin/om-alert.sh "system power warning"'
omconfig system alertaction event=powersupply execappath='/usr/local/bin/om-alert.sh "psu critical"'
omconfig system alertaction event=powersupplywarn execappath='/usr/local/bin/om-alert.sh "psu warning"'
omconfig system alertaction event=processorwarn execappath='/usr/local/bin/om-alert.sh "processor warning"'
omconfig system alertaction event=processorfail execappath='/usr/local/bin/om-alert.sh "processor failure"'
omconfig system alertaction event=redundegrad execappath='/usr/local/bin/om-alert.sh "redundancy degraded"'
omconfig system alertaction event=redunlost execappath='/usr/local/bin/om-alert.sh "redundancy lost"'
omconfig system alertaction event=tempwarn execappath='/usr/local/bin/om-alert.sh "temp probe warning"'
omconfig system alertaction event=tempfail execappath='/usr/local/bin/om-alert.sh "temp probe failure"'
omconfig system alertaction event=voltwarn execappath='/usr/local/bin/om-alert.sh "voltage probe warning"'
omconfig system alertaction event=voltfail execappath='/usr/local/bin/om-alert.sh "voltage probe failure"'
omconfig system alertaction event=watchdogasr execappath='/usr/local/bin/om-alert.sh "Watchdog ASR"'
omconfig system alertaction event=storagesyswarn execappath='/usr/local/bin/om-alert.sh "storage system warning"'
omconfig system alertaction event=storagesysfail execappath='/usr/local/bin/om-alert.sh "storage system failure"'
omconfig system alertaction event=storagectrlwarn execappath='/usr/local/bin/om-alert.sh "storage controller warning"'
omconfig system alertaction event=storagectrlfail execappath='/usr/local/bin/om-alert.sh "storage controller failure"'
omconfig system alertaction event=pdiskwarn execappath='/usr/local/bin/om-alert.sh "physical disk warning"'
omconfig system alertaction event=pdiskfail execappath='/usr/local/bin/om-alert.sh "physical disk failure"'
omconfig system alertaction event=vdiskwarn execappath='/usr/local/bin/om-alert.sh "virtual disk warning"'
omconfig system alertaction event=vdiskfail execappath='/usr/local/bin/om-alert.sh "virtual disk failure"'
omconfig system alertaction event=enclosurewarn execappath='/usr/local/bin/om-alert.sh "enclosure warning"'
omconfig system alertaction event=enclosurefail execappath='/usr/local/bin/om-alert.sh "enclosure failure"'
omconfig system alertaction event=storagectrlbatterywarn execappath='/usr/local/bin/om-alert.sh "storage ctrl battery warning"'
omconfig system alertaction event=storagectrlbatteryfail execappath='/usr/local/bin/om-alert.sh "storage ctrl battery failure"'
Did you find this article useful? Why not share it with your friends?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.