Skip to main content

設置Dell服務器硬件警報的電子郵件通知

設置Dell服務器硬件警報的電子郵件通知

Geoffrey Carr

所有戴爾服務器都配有Dell OpenManage Server Administrator軟件,該軟件能夠監控和顯示系統級指示燈。此外,通過“警報管理”選項卡,您可以配置在觸發警報時要執行的操作。遺憾的是,沒有工具可以對所有事件應用統一通知,因此我們將提供一個腳本,配置所有警報操作以發送電子郵件通知您相應的事件。雖然您可以手動設置這些,但是擁有腳本是理想的,因為您可以輕鬆地在多個服務器上進行部署。

這個怎麼運作

腳本非常簡單。有一個setup命令,它將每個警報設置為“Execute application”,應用程序是腳本本身。當腳本運行時,它只會生成一個電子郵件(通過使用Blat工具),並觸發計算機名稱,日期,時間和警報。

在運行腳本之前:

運行腳本後:

所有警報都使用電子郵件通知腳本:

要求

當然,您需要安裝Dell OpenManage Server Assistant。如果您的系統未隨附該軟件,則可通過Dell的支持網站下載該軟件。

此外,您需要在系統上配置Blat,一個命令行電子郵件程序。要配置Blat,只需下載二進製文件並將它們(總共3個:blat.exe,blat.dll,blat.lib)解壓縮到系統PATH變量中的某個位置,例如Windowssystem32文件夾。然後從命令行運行:

blat -install my.mailserver.com [email protected]

適當地替換郵件服務器和電子郵件地址。在大多數情況下,此命令是您需要運行的所有命令,但如果您的服務器具有特殊配置(備用端口等),您可以在Blat的網站上查看完整安裝選項。

電子郵件警報通知設置

一旦滿足這些要求,就可以使用該腳本了。編輯腳本以包含要通知的電子郵件地址('ToEmail'變量)。如果您的服務器需要身份驗證才能進行中繼,則必須將這些參數添加到Blat命令中,如腳本中所述。

要設置Server Assistant警報以使用該腳本,只需運行安裝程序:

DellAlert /setup

確認您要將此腳本用作警報操作,並且您已完成設置。作為設置的一部分,會觸發示例警報,以確保電子郵件能夠到達目標收件人。

劇本

@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 [email protected] 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

腳本修改/維護

來自所提供腳本的事件警報來自我們的某個Dell服務器。根據您的Dell服務器硬件和Server Assistant版本,警報可能會有所不同。通常,如果事件對您的服務器無效(例如,如果您沒有Dell RAID控制器),則可以告訴您何時運行安裝腳本,因為某些存儲事件創建項將失敗。

上面腳本中的事件觸發器是通過從命令提示符運行以下命令獲得的:

omconfig system alertaction /?

此命令列出所有事件關鍵字以及相應警報的描述。要添加其他警報,請運行上面的命令並將缺少的條目添加到腳本的安裝部分,然後使用/ Setup開關重新運行腳本。

鏈接

從SysadminGeek.com下載Dell服務器電子郵件警報腳本

下載Blat Command Line Emailer

戴爾支持網站

Link
Plus
Send
Send
Pin