Email Script When Interface Status Change (Running or Not Running)

Just let the router do it internally - instead of a script…

/system logging
add action=emailalert disabled=no prefix=“” topics=info,interface

Then change your email alert settings:

/system logging action
remove [find name=“emailalert”]
add email-to=noc@youremaildomain.com name=emailalert target=email

I do not understand dear friend.

The built in syslog functions will put into the log when an interface goes up and down. YOu just need to add a syslog event to email that to you. We use it all the time - every time an interface goes up and down it will email our NOC. No script needed. Try it. Paste in those commands with a valid working email relay and you should get emails.

I just pasted the commands and it doesn’t create any rules, my email is enkas012016@gmai.com

Solution is simple and Easy rather then Scripting…

Thank You So much for the Idea

When my DHCP clients update… A script in the DHCP client updates my recursive gateways.

So it happens at every DHCP lease.

I tried this and nothing happened. I went into system logging and tried to do it manually but there is no email option.

Do you need to be on a certain routeros for this to work?

Great idea! thanks.

/system logging action
add email-start-tls=yes email-to=myemail@gmail.com name=sendinterface target=email

/system logging
add action=sendinterface topics=interface

BR.

That works, thank you!

Is there any way to add more info to the email like the router name and a message?

No, you must use scripts / netwatch

Thanks Rex.

What is the best way to send an email upon failover? I’m using recursive routes but I don’t have any scripting set up. I was trying to avoid scripts if possible, but it seems like for this I will need it.

I just want to email when the main isp goes down, and then again when it comes back up.

First of all, check other topics about dual wan failover, then simply netwatch 1.1.1.1 and 8.8.8.8 and send proper mail accordingly…

This does work, but for the love of god i can’t make mikrotik send any information about the board thus i don’t know what is it good for. There is a field “from” : Name or email address that will be shown as receiver.
But it doesnt work i tried to put device name there or an IP but i wont recieve an email, it does show in a log that has been sent but never deleivered. You have to change it to exactly same name as “user” is then it works. Then i wont recognize from which device it was sent, am i missing something? using ROS 6.48 on this particular board.

https://wiki.mikrotik.com/wiki/Manual:Tools/email#Properties