Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
Notifications - Any way to get the IP Address of the WAN when I get an alert?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Notifications - Any way to get the IP Address of the WAN when I get an alert? (Read 4225 times)
sedace
Newbie
Posts: 15
Karma: 0
Notifications - Any way to get the IP Address of the WAN when I get an alert?
«
on:
June 29, 2018, 09:32:49 pm »
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.
Logged
faunsen
Full Member
Posts: 102
Karma: 17
Re: Notifications - Any way to get the IP Address of the WAN when I get an alert?
«
Reply #1 on:
July 04, 2018, 01:06:51 pm »
Just an idea.
You could use the
Monit Plugin
.
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:
Code:
[Select]
#!/bin/csh
( printf "To: $1\nSubject: Interface Link Down\n\n" ; ifconfig $2 ) | sendmail $1
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
Notifications - Any way to get the IP Address of the WAN when I get an alert?