Advertisement
Guest User

Dell hardware alert script

a guest
Jul 27th, 2015
1,108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. @ECHO OFF
  2. TITLE Dell Hardware Email Alert
  3. ECHO Dell Hardware Email Alert
  4. ECHO Reddit
  5. ECHO.
  6. ECHO.
  7.  
  8. REM Sends email alerts when Dell hardware warnings are triggered.
  9. REM This script should _not_ be in a path which contains spaces.
  10. REM
  11. REM Usage:
  12. REM DellAlert {/SETUP | Alert message}
  13. REM /SETUP Configure Dell Server Assistant to use this script for alerts.
  14. REM Alert Message
  15. REM Message to send.
  16. REM
  17. REM Requires:
  18. REM Blat : (command line emailer) is configured and working on the current system.
  19. REM If your email server requires authentication to relay, see comments below.
  20.  
  21. REM Email address(es) to send alerts to (comma separated)
  22. SET ToEmail=myaddress@email.com
  23.  
  24. SETLOCAL EnableExtensions
  25.  
  26. IF /I {%1}=={/SETUP} GOTO Setup
  27. IF NOT {%1}=={} GOTO Alert
  28. GOTO End
  29.  
  30. :Alert
  31. SET Log="%TEMP%DellAlert.txt"
  32.  
  33. DATE /T > %Log%
  34. TIME /T >> %Log%
  35. ECHO Dell Alert Tripped! >> %Log%
  36. ECHO %* >> %Log%
  37.  
  38. REM If your email server requires autentication to relay,
  39. REM add the following to the end of the line below:
  40. REM -u UserName -pw Password
  41. BLAT %Log% -to %ToEmail% -subject "%ComputerName% Hardware Alert"
  42.  
  43. IF EXIST %Log% DEL /F /Q %Log%
  44. GOTO End
  45.  
  46. :Setup
  47. ECHO This will replace all the current Dell Server Assistant alerts with a call
  48. ECHO to this script. To confirm you want to continue, enter YES (case sensitive).
  49. SET /P Confirm=
  50. IF NOT {%Confirm%}=={YES} GOTO End
  51.  
  52. SET ScriptPath=%~dpnx0
  53. ECHO Configuring alerts to use: %ScriptPath%
  54.  
  55. omconfig system alertaction event=powersupply execappath="%ScriptPath% power supply failure"
  56. omconfig system alertaction event=powersupplywarn execappath="%ScriptPath% power supply warning"
  57. omconfig system alertaction event=tempwarn execappath="%ScriptPath% temperature warning"
  58. omconfig system alertaction event=tempfail execappath="%ScriptPath% temperature failure"
  59. omconfig system alertaction event=fanwarn execappath="%ScriptPath% fan speed warning"
  60. omconfig system alertaction event=fanfail execappath="%ScriptPath% fan speed failure"
  61. omconfig system alertaction event=voltwarn execappath="%ScriptPath% voltage warning"
  62. omconfig system alertaction event=voltfail execappath="%ScriptPath% voltage failure"
  63. omconfig system alertaction event=intrusion execappath="%ScriptPath% chassis intrusion"
  64. omconfig system alertaction event=redundegrad execappath="%ScriptPath% redundancy degraded"
  65. omconfig system alertaction event=redunlost execappath="%ScriptPath% redundancy lost"
  66. omconfig system alertaction event=memprefail execappath="%ScriptPath% memory pre-failure"
  67. omconfig system alertaction event=memfail execappath="%ScriptPath% memory failure"
  68. omconfig system alertaction event=hardwarelogwarn execappath="%ScriptPath% hardware log warning"
  69. omconfig system alertaction event=hardwarelogfull execappath="%ScriptPath% hardware log full"
  70. omconfig system alertaction event=processorwarn execappath="%ScriptPath% processor warning"
  71. omconfig system alertaction event=processorfail execappath="%ScriptPath% processor failure"
  72. omconfig system alertaction event=watchdogasr execappath="%ScriptPath% watchdog asr"
  73. omconfig system alertaction event=batterywarn execappath="%ScriptPath% battery warning"
  74. omconfig system alertaction event=batteryfail execappath="%ScriptPath% battery failure"
  75. omconfig system alertaction event=systempowerwarn execappath="%ScriptPath% system power warning"
  76. omconfig system alertaction event=systempowerfail execappath="%ScriptPath% system power failure"
  77.  
  78. omconfig system alertaction event=storagesyswarn execappath="%ScriptPath% storage system warning"
  79. omconfig system alertaction event=storagesysfail execappath="%ScriptPath% storage system failure"
  80. omconfig system alertaction event=storagectrlwarn execappath="%ScriptPath% storage controller warning"
  81. omconfig system alertaction event=storagectrlfail execappath="%ScriptPath% storage controller failure"
  82. omconfig system alertaction event=pdiskwarn execappath="%ScriptPath% physical disk warning"
  83. omconfig system alertaction event=pdiskfail execappath="%ScriptPath% physical disk failure"
  84. omconfig system alertaction event=vdiskwarn execappath="%ScriptPath% virtual disk warning"
  85. omconfig system alertaction event=vdiskfail execappath="%ScriptPath% virtual disk failure"
  86. omconfig system alertaction event=enclosurewarn execappath="%ScriptPath% enclosure warning"
  87. omconfig system alertaction event=enclosurefail execappath="%ScriptPath% enclosure failure"
  88. omconfig system alertaction event=storagectrlbatterywarn execappath="%ScriptPath% storage controller battery warning"
  89. omconfig system alertaction event=storagectrlbatteryfail execappath="%ScriptPath% storage controller battery failure"
  90.  
  91. ECHO.
  92. ECHO Sending sample alert to:
  93. ECHO %ToEmail%
  94. CALL :Alert Testing Dell hardware alert warnings...
  95. ECHO.
  96. PAUSE
  97. GOTO End
  98.  
  99. :End
  100. ENDLOCAL
  101. Script Mo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement