Hi Guys,
I need some HELP!
Im doing a script for a Mikrotik for a ping test.
Basically the MT needs to ping an ip and if the ip got 5 request timeouts it must do a task(the task is to disable a route on the MT ). But I can't get it to work can you see if below makes any sense for you. Then I have the same script for a up check. So basically if the ping to 10.10.10.1 fails for 5 times it swaps to alternative route( disabling the Default route)
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 10.10.10.1 interval=3 count=1]=0))};
:if ($i=5 && ( [/ip route find where comment ="Default Route" disabled=yes ] != "")) do={:log info "have swapped";
}
Below is the UP check
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 10.10.10.1 interval=3 count=1]=1))};
:if ($i=5 && ( [/ip route find where comment ="Default Route" disabled=no ] != "")) do={:log info "have not swapped route";
}
best Regards