Setup Notification on MultiWAN State Changes
This guide will help you set up notification when your MultiWAN changes state and the number of interfaces in play. Please note that this is an internal process and at least 1 interface needs to remain operational for the system to be able to send the notification. If you want external notification, you should consider using the SDN to monitor services on your box using the System Monitor Service.
This Howto requires that you are using MultiWAN on your system. In addition, you will need to have the local SMTP server running and working.
Install and test mutt
This method uses the 'mutt' command to send email to the local email server running on the box running MultiWAN. To install 'mutt', open a command prompt and run the following:
yum --enablerepo=clearos-core install mutt
Next, test 'mutt' by running the following (replacing the email address with your own):
echo "This is a test attachment" > /tmp/testmessage1.txt
echo "Testing mutt" | /usr/bin/mutt email@example.com -a /tmp/testmessage1.txt -s "Test Message"
rm -rf /tmp/testmessage1.txt
You should get your test email. If this doesn't work, troubleshoot your email server and the 'mutt' command before proceeding.
MultiWAN already has a facility for processing a script when a change in status even occurs. We will implement a script to do this. First, ensure that you don't already have one in place:
This should return:
cat: /usr/sbin/syswatch.local: No such file or directory
Next, create the file and make it executable:
chmod 700 /usr/sbin/syswatch.local
Now modify the file with the following (using your favorite editor like vi or nano):
/bin/grep "changing active WAN list" /var/log/syswatch | /usr/bin/tail -n 1 | /usr/bin/mutt $email -a /var/log/syswatch -s "MultiWAN active interfaces CHANGED `/bin/date`"