#!/bin/sh ######################################## # Description: This script is used to handle the different events for the # Dell OpenManage Server Administrator service. # Required files: hostname, date, printf, msmtp ######################################## #################### # Set variables #################### event=$1 hostname=/bin/hostname host=`$hostname -s` date=/bin/date current_day=`$date +%m/%d/%y` current_time=`$date +%H:%M:%S` timestamp="$current_day $current_time" printf=/usr/bin/printf from=noreply@test.com recipient=alerts@test.com msmtp=/usr/bin/msmtp msmtp_config=/etc/msmtprc case "$event" in powersupply) description="A power supply probe detected a failure value." ;; powersupplywarn) description="A power supply probe detected a warning value." ;; tempwarn) description="A temperature probe detected a warning value." ;; tempfail) description="A temperature probe detected a failure value." ;; fanwarn) description="A fan probe detected a warning value." ;; fanfail) description="A fan probe detected a failure value." ;; voltwarn) description="A voltage probe detected a warning value." ;; voltfail) description="A voltage probe detected a failure value." ;; intrusion) description="A chassis intrusion event is detected." ;; redundegrad) description="A redundant component become inoperative." ;; redunlost) description="One or more redundant components became inoperative." ;; memprefail) description="A memory probe detected a prefailure value." ;; memfail) description="A memory probe detected a failure value." ;; hardwarelogwarn) description="A hardware log detected a warning value." ;; hardwarelogfull) description="A hardware log is full." ;; processorwarn) description="A processor probe detected a warning value." ;; processorfail) description="A processor probe detected a failure value." ;; watchdogasr) description="A watchdog Automatic System Recovery (ASR) will be performed at the next system startup." ;; batterywarn) description="A battery probe detected a warning value." ;; batteryfail) description="A battery probe detected a failure value." ;; systempowerwarn) description="A power consumption probe detected a warning value." ;; systempowerfail) description="A power consumption probe detected a failure value." ;; systempeakpower) description="A power consumption probe peak power value." ;; removableflashmediapresent) description="The system detected a removable flash media." ;; removableflashmediaremoved) description="A removable flash media is removed." ;; removableflashmediafail) description="A removable flash media fails." ;; storagesyswarn) description="A storage system detected a warning value." ;; storagesysfail) description="A storage system detected a failure value." ;; storagectrlwarn) description="A storage controller detected a warning value." ;; storagectrlfail) description="A storage controller detected a failure value." ;; pdiskwarn) description="A physical disk detected a warning value." ;; pdiskfail) description="A physical disk detected a failure value." ;; vdiskwarn) description="A virtual disk detected a warning value." ;; vdiskfail) description="A virtual disk detected a failure value." ;; enclosurewarn) description="An enclosure detected a warning value." ;; enclosurefail) description="An enclosure detected a failure value." ;; storagectrlbatterywarn) description="A storage controller battery detected a warning value." ;; storagectrlbatteryfail) description="A storage controller battery detected a failure value." ;; *) exit 0 ;; esac subject="System Alert: Dell OMSA event ($event) on $host [$timestamp]" body="$timestamp $description" $printf "From: $from\nTo: $recipient\nSubject: $subject\n\n$body" | $msmtp --file=$msmtp_config -t exit 0