Page 1 of 1

OSPF backup route send email

Posted: Mon Jun 12, 2017 1:05 pm
by arky
Hi,
I have an OSPF routing network. On one router I have backup routes by ether10 and ether9. When the ether10 falls, the route switches to ether9. At this point in the window routing -> ospf-> routes shows me the IP gateway of the distant router 10.20.180.12.
And now the question of how to send the email that the traffic with ether10 jumped on ether9?
I thought to check the moment of appearance of the gateway (10.20.180.120) script but something can not embrace it.

Re: OSPF backup route send email

Posted: Mon Jun 12, 2017 6:23 pm
by gustavomam
Hi,

Test this

Set in e-mail settings
/tool e-mail
set address=smtp.gmail.com from=<mail@gmail.com> password=abc123 port=587 start-tls=yes user=mail@gmail.com

Create script

:global status10 [interface ethernet get ether10 running]
:global status9 [interface ethernet get ether9 running]

:if ($status10 = true&& $status9 = false) do={
:log info ("route2 disabled")
/tool e-mail send to="peter@gmail.com" subject="ALERT route 2 disabled"
}

:if ($status9 = true && $status10 = false) do={
:log info ("route1 disabled")
/tool e-mail send to="peter@gmail.com" subject="ALERT route 1 disabled"
}

Re: OSPF backup route send email

Posted: Mon Jun 12, 2017 10:51 pm
by JohnSmith75
Give a feedback please, does it helps you or not?

Re: OSPF backup route send email

Posted: Tue Jun 13, 2017 9:23 am
by nichky
Does anyone check this one?

Re: OSPF backup route send email

Posted: Thu Jun 15, 2017 9:05 pm
by arky
Hi Gustavo,
I do not want to disable ether9 or 10 interface.
On ether 9 and 10 I have OSPF. Now the traffic goes to ether9 interfers and when it stops P2P traffic it switches me traffic to the second link via ethjer10.
This is like a script to investigate when all traffic has switched to ether10.

Re: OSPF backup route send email

Posted: Fri Jun 16, 2017 9:39 am
by gustavomam
Ok

Arky you can use this:
:global gateway1 ("10.20.180.120")
/ip route {
:foreach i in=[find gateway=$gateway1] do={
:if ([/ip route get $i active]) do={
/tool e-mail send to="peter@gmail.com" subject="ALERT Gateway1 is enable"
:log info ("ALERT Gateway1 is enable") ;
} else={
/tool e-mail send to="peter@gmail.com" subject="ALERT Gateway1 is disable"
:log info ("ALERT Gateway1 is disable") ;
}
}
}
	

Re: OSPF backup route send email

Posted: Fri Jun 16, 2017 7:33 pm
by nichky
gustavomam, Did you check that one in your MT. Does it work well?

Re: OSPF backup route send email

Posted: Fri Jun 16, 2017 9:11 pm
by gustavomam
Yes I have tried it early morning

Did it work for you?

Re: OSPF backup route send email

Posted: Sun Jun 18, 2017 5:30 pm
by arky
Hi Gustawo,
We have some progress.
I started the script at home and at the moment of switching traffic on ether10 w / ip route has a number of dynamic gateways (D-dynamic A-active o-OSPF). For each gateway sends email and logs and as a result I have 40 emails and logs. How to crush one?
When route goes back to ether9 and no 10.10.180.120 in / ip route this script will not send email or log.

Re: OSPF backup route send email

Posted: Mon Jun 19, 2017 4:59 pm
by gustavomam
Hi.

Maybe you can complete your routine with a more conditions like this:
:foreach i in=[find gateway=$gateway1 && active && dst-address=0.0.0.0/0] do={