I've got alerts setup so that I get notified when a wan interface has high latency or goes down. I was curious if there's a way to get the IP Address of the WAN included when it comes back up? 99% of the time it's the same IP but it'd be nice to know if the ISP changes it.
I know I can use Dynamic DNS, I'm not sure I want to expose that I have services running on my network by using that option.
Not a big deal, but I figured someone may know more about scripting than I do that could point me in the right direction if it's even possible.
Just an idea.
You could use the Monit Plugin (https://forum.opnsense.org/index.php?topic=5303.0).
Create a test that executes a script on failure. And that script sends the ifconfig output to you.
Unfortunately Monit cannot send script output.
Therefore we send emails from command line via the os-postfix plugin.
Install and enable it.
Then configure Monit:
E.g.
Test
Name: TestWANLink
Condition: failed link
Action: Execute
Path: /usr/local/bin/IfaceAlert.sh "you@domain.tld" vtnet0
In this example "you@domain.tld" is the recipient and vtnet0 is the WAN interface (see Interfaces->Assignments)
Service
Name: WANLink
Type: Network
Interface: WAN
Tests: TestWANLink
The script /usr/local/bin/IfaceAlert.sh could look like this:
#!/bin/csh
( printf "To: $1\nSubject: Interface Link Down\n\n" ; ifconfig $2 ) | sendmail $1