ICR-3211
Send an E-mail
This script is going to send an e-mail message for when the power supply will reach the
defined threshold voltage. Firts, ensure the SNMP credentials are configured in the
Configu-
ration -> Services -> SMTP
configuration page.
Following items should be revised in the script:
•
destined e-mail address,
•
threshold for minimal power supply voltage,
•
subject and body of the e-mail (
$VOLTAGE
variable stands for the value of the actual
power supply voltage).
# This script monitors the supply voltage and will send an e-mail if below the
treshold.
EMAIL_TO="[email protected]" # Set the destined e-mail address
THRESHOLD=8
# Set the threshold voltage level
SENT=0
while true; do
VOLTAGE=‘status sys | awk ’/Voltage/ { print $4 }’‘
if [ $THRESHOLD -lt ${VOLTAGE%.*} ]; then
SENT=0
elif [ $SENT -eq 0 ]; then
# Sending the e-mail with subject (-s) and body (-m).
email -t $EMAIL_TO -s "Power supply outage..." -m "Actual voltage is $VOLTAGE V."
SENT=1
fi
sleep 1
done
21