Setup Email Notifications for Dell Server Hardware Alerts

By Jason Faulkner on July 21st, 2010

All Dell servers come with the Dell OpenManage Server Administrator software which has the ability to monitor and display system level indicators. Additionally, through the Alert Management tab you can configure actions to execute whenever an alert is triggered. Unfortunately there is no vehicle for applying uniform notifications to all events, so we are going to provide a script which configures all the alert actions to send an email notifying you of the respective event. While you could set these up manually, having a script is ideal as you can easily deploy this across multiple servers.

How it Works

The script is very simple. There is a setup command which sets each alert to “Execute application” with the application being the script itself. When the script runs, it simply generates an email (by using the the Blat tool) with the computer name, date, time and alert triggered.

Before script is run:

image

After script is run:

image

All alerts use the email notification script:

image

Requirements

Of course, you will need to have Dell OpenManage Server Assistant installed. This software, if not provided with your system, is downloadable through Dell’s support site.

Additionally, you will need to have Blat, a command line emailer, configured on your system. To configure Blat, just download the binary files and extract them (3 total: blat.exe, blat.dll, blat.lib) to a location in your system’s PATH variable, such as your Windowssystem32 folder. Then from the command line, run:

blat -install my.mailserver.com fromaddress@email.com

Replace the mail server and from email address appropriately. For the most part this command is all you need to run, but if your server has a special configuration (alternate port, etc.), you can see the full install options on Blat’s website.

Email Alert Notification Setup

Once you have these requirements in place, you are ready to use the script. Edit the script to include the email address(es) to notify (the ‘ToEmail’ variable). If your server requires authentication to relay, you will have to add these parameters to the Blat command as documented in the script.

To setup the Server Assistant alerts to use the script, just run the setup:

DellAlert /setup

Confirm you want to use this script as your alert action and you are all set. As part of the setup, a sample alert is triggered so you can make sure the emails are reaching the intended recipients.

The Script

@ECHO OFF
TITLE Dell Hardware Email Alert
ECHO Dell Hardware Email Alert
ECHO Written by: Jason Faulkner
ECHO SysadminGeek.com
ECHO.
ECHO.

REM Sends email alerts when Dell hardware warnings are triggered.
REM This script should _not_ be in a path which contains spaces.
REM
REM Usage:
REM DellAlert {/SETUP | Alert message}
REM    /SETUP   Configure Dell Server Assistant to use this script for alerts.
REM    Alert Message
REM             Message to send.
REM
REM Requires:
REM Blat : (command line emailer) is configured and working on the current system.
REM        If your email server requires authentication to relay, see comments below.

REM Email address(es) to send alerts to (comma separated)
SET ToEmail=myaddress@email.com

SETLOCAL EnableExtensions

IF /I {%1}=={/SETUP} GOTO Setup
IF NOT {%1}=={} GOTO Alert
GOTO End

:Alert
SET Log="%TEMP%DellAlert.txt"

DATE /T > %Log%
TIME /T >> %Log%
ECHO Dell Alert Tripped! >> %Log%
ECHO %* >> %Log%

REM If your email server requires autentication to relay,
REM add the following to the end of the line below:
REM -u UserName -pw Password
BLAT %Log% -to %ToEmail% -subject "%ComputerName% Hardware Alert"

IF EXIST %Log% DEL /F /Q %Log%
GOTO End

:Setup
ECHO This will replace all the current Dell Server Assistant alerts with a call
ECHO to this script. To confirm you want to continue, enter YES (case sensitive).
SET /P Confirm=
IF NOT {%Confirm%}=={YES} GOTO End

SET ScriptPath=%~dpnx0
ECHO Configuring alerts to use: %ScriptPath%

omconfig system alertaction event=powersupply execappath="%ScriptPath% power supply failure"
omconfig system alertaction event=powersupplywarn execappath="%ScriptPath% power supply warning"
omconfig system alertaction event=tempwarn execappath="%ScriptPath% temperature warning"
omconfig system alertaction event=tempfail execappath="%ScriptPath% temperature failure"
omconfig system alertaction event=fanwarn execappath="%ScriptPath% fan speed warning"
omconfig system alertaction event=fanfail execappath="%ScriptPath% fan speed failure"
omconfig system alertaction event=voltwarn execappath="%ScriptPath% voltage warning"
omconfig system alertaction event=voltfail execappath="%ScriptPath% voltage failure"
omconfig system alertaction event=intrusion execappath="%ScriptPath% chassis intrusion"
omconfig system alertaction event=redundegrad execappath="%ScriptPath% redundancy degraded"
omconfig system alertaction event=redunlost execappath="%ScriptPath% redundancy lost"
omconfig system alertaction event=memprefail execappath="%ScriptPath% memory pre-failure"
omconfig system alertaction event=memfail execappath="%ScriptPath% memory failure"
omconfig system alertaction event=hardwarelogwarn execappath="%ScriptPath% hardware log warning"
omconfig system alertaction event=hardwarelogfull execappath="%ScriptPath% hardware log full"
omconfig system alertaction event=processorwarn execappath="%ScriptPath% processor warning"
omconfig system alertaction event=processorfail execappath="%ScriptPath% processor failure"
omconfig system alertaction event=watchdogasr execappath="%ScriptPath% watchdog asr"
omconfig system alertaction event=batterywarn execappath="%ScriptPath% battery warning"
omconfig system alertaction event=batteryfail execappath="%ScriptPath% battery failure"
omconfig system alertaction event=systempowerwarn execappath="%ScriptPath% system power warning"
omconfig system alertaction event=systempowerfail execappath="%ScriptPath% system power failure"

omconfig system alertaction event=storagesyswarn execappath="%ScriptPath% storage system warning"
omconfig system alertaction event=storagesysfail execappath="%ScriptPath% storage system failure"
omconfig system alertaction event=storagectrlwarn execappath="%ScriptPath% storage controller warning"
omconfig system alertaction event=storagectrlfail execappath="%ScriptPath% storage controller failure"
omconfig system alertaction event=pdiskwarn execappath="%ScriptPath% physical disk warning"
omconfig system alertaction event=pdiskfail execappath="%ScriptPath% physical disk failure"
omconfig system alertaction event=vdiskwarn execappath="%ScriptPath% virtual disk warning"
omconfig system alertaction event=vdiskfail execappath="%ScriptPath% virtual disk failure"
omconfig system alertaction event=enclosurewarn execappath="%ScriptPath% enclosure warning"
omconfig system alertaction event=enclosurefail execappath="%ScriptPath% enclosure failure"
omconfig system alertaction event=storagectrlbatterywarn execappath="%ScriptPath% storage controller battery warning"
omconfig system alertaction event=storagectrlbatteryfail execappath="%ScriptPath% storage controller battery failure"

ECHO.
ECHO Sending sample alert to:
ECHO %ToEmail%
CALL :Alert Testing Dell hardware alert warnings...
ECHO.
PAUSE
GOTO End

:End
ENDLOCAL

Script Modifications/Maintenance

The event alerts from the provided script are from one of our Dell servers. Depending on your Dell server hardware and Server Assistant version, the alerts may vary. Generally, you can tell when you run the setup script if an event is not valid for your server (for example, if you don’t have Dell RAID controllers) as some of the storage event creation items will fail.

The event triggers in the script above were obtained by running the following from a command prompt:

omconfig system alertaction /?

This command lists all event keywords with a description of the respective alert. To add additional alerts, run the command above and add the missing entries to the setup portion of the script and then rerun the script with the /Setup switch.

Links

Download Dell Server Email Alert Script from SysadminGeek.com

Download Blat Command Line Emailer

Dell Support Site

Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 07/21/10
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!