Netwatch ISP failover email notification

Hi,

i have an issue regarding email notification in case of primary ISP went up/down.

I recieve email notification without any issue when enabling or disabling netwatch script.
But when i simulate ISP failover inside firewall by dropping ICMP 8.8.8.8 and internet is moving to secondary ISP (which works fine) i didn’t receive email notification. In the logging i see message: Error sending e-mail : timeout occured.

Maybe it’s a transition issue because in that period when he wants to send the mail the ISP is switching and internet isn’t avaiable? Is there any option to add a delay for sending the email?

Thanks!

It may indeed be pure logic.

If you want to have a delay:
hard coded

:delay <whatevertimeinsecondsyouwant>

Nicer (concept):

  • wait until a certain URL can be resolved (with timeout to avoid infinite wait)
  • then send the mail
    I don’t have any examples at hand but there should be some floating around if you search a bit.

Thanks for your reply. I have tried to add the delay command but it doesn’t work (no email had been send).

tool e-mail send from="info@xxx-xxx.com" server=xxx.xxx.de user=info@xxx-xxx.com password=xxx subject="ISP OPTICAL UP" body="ISP OPTICAL is up on $[/system clock get time]" to="xxx.xxx@googlemail.com":delay <20> 

ip route enable [find dst-address=0.0.0.0/0 gateway=pppoe-out]
:log warning "ISP OPTICAL is up"

Delay needs to be added BEFORE tool email …

First wait. Then send.

And simply
:delay 20

No brackets needed.

Thanks! Now everything works!