Created
October 7, 2017 16:31
-
-
Save arevindh/7768428254969cdf44ea4a6dc24a820b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://community.ubnt.com/t5/EdgeMAX/WAN-Failure-notification/td-p/771248/page/2 | |
I know I'm resurrecting an old thread, but here's the script and command I used. Hopefully it helps someone. | |
It's pretty basic, but it works. I used an external SMTP delivery service, Mailgun, to handle the email transport - this allows me to just use curl to send the message via their API. Mailgun is free for upto 10,000 emails/month. | |
set load-balance group WAN_FAILOVER transition-script /config/scripts/wlb-notification | |
#!/bin/bash | |
# Echo usage if no arguments passed | |
if [ $# -eq 0 ] | |
then | |
echo "Usage: $0 [group ] [interface] [status]" | |
exit 0 | |
fi | |
curl=/usr/bin/curl | |
group=$1 | |
interface=$2 | |
status=$3 | |
curl -s --user 'api:xxxxxxxxxxxxxxxxxxxxxx' \ | |
https://api.mailgun.net/v2/xxxxxxxxxxxx.com/messages \ | |
-F from='xxxxxxxxxxx <xxxxxxxxxx@xxxxxxxx.com>' \ | |
-F to='xxxx xxxxxx <xxxxxxxxxx@xxxxxxxxx.com>'\ | |
-F subject="ALERT: Internet Connection on $interface status $status" \ | |
-F text="ALERT: Internet Connection on $interface status $status" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment