script to email an alert if link goes down

hi guys
I’m trying to figure out how to make my own script doing netwatch and a bit more sophistication. which is to ping google.com for isntance by src-address=blah.blat.blax.blay
and send an email only once when the link went down and send another email when the link went up.

these are the problems:

  • if my link A goes down my mail server is down as well so I don’t know how to re-route my mail server to other links since the other isp doesn’t allow routing none local IP addressess.

  • if I put it as scheduler and set the scheduler to run every 30 second it will send one email every 30 second which I only need it once.

  • I am not good at scripting to start it from scratch. some thoughts are appreciated a lot.


    thanks

Use two scripts:

Script1
Ping
If down, send email, disable Script1, enable Script2

Script2
Ping
If Up, send email, disable Script2, enable Script1

Does that help?

disabling the code is very good idea…
I try to write something from scratch… since I dont have much experience in scripting under routerOS


thanks a lot