Hi all,
I’m making a script (run by netwatch) to send me emails whenever the router is up/down, right? Well, there are some things that I’m unclear about, and am wondering if you guys can help. ![]()
- I’m trying to make it so that the email would read “Router is down at dd-mm-yyyy hh:mm:ss”, instead of just the “Router is down” that I have now.
Here’s my current script:
source=
:log info "Main Gateway is DOWN";
/tool e-mail send from="admin@myrouter.com" server="xxx.xxx.xxx.xxx"
body="Router is DOWN" subject="Router is DOWN" to="owner@myrouter.com"
I tried using + and &, doesn’t work. Heheh… What’s mikrotik’s symbol for merging strings together?
- I tried adding a flood ping before the “/tool e-mail send” line, like so:
/tool flood-ping xxx.xxx.xxx.xxx
:log info "Flood ping commenced"
Will the router do the flood ping just that once, or will it ping continuously?
-
I also want to make it so that in the log, the color of the line changes, say to red if down, green if up.
Is that possible? -
It seems that there are quite a number of false positives generated by the script, and I’m trying to get rid of them. I read in the wiki that there’s this script:
:local i 0;
{:do {:set i ($i + 1)} while �i < 5) && ([/ping 64.233.169.99 interval=3 count=1]=0)};
:if ($i=5 && [/ip route get [find comment="Default Route"] distance]=1) do={:log info "Main Gateway down";
/ip route set [find comment="Default Route"] distance=3}
If you read the 2nd line (the “do” line), there’s a box after “while”, right? I couldn’t, for the live of me, guess what that character should be. If I copy-pasted from the forum, the line would read “while ?i < 5”, and would give me an error when I tried to run it. Of course I will be modifying the script to better suit my situation, but can anyone please tell me what that character should be?
Thanks much.