hidagar
October 21, 2010, 10:55am
1
Hello,
I want to implement a netwatch but it must try 5 times before run the script, i tried to do this but its not working. someone can help me please?
THanks
:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 192.168.1.1 interval=1 count=1]=0))};
:if $i=5 do={/interface disable 4 }
mrz
October 21, 2010, 11:21am
2
Use tool/netwatch and adjust interval and timeout values to suite your needs.
hidagar
October 21, 2010, 11:22am
3
Hello,
I need to do 5 timeouts before run script, in timeout works in time that the ping its lose.
janisk
October 25, 2010, 11:07am
5
sorry but this is as simple as it gets:
http://wiki.mikrotik.com/wiki/Netwatch
believe me, 3 or 5 not big difference since these 3 are called with 1 sec interval and 1 sec timeout.
hidagar
October 25, 2010, 11:12am
6
Sorry, but
interval (time; Default: 1m) Time interval between pings. Lowering this will make state changes more responsive, but can create unnecessary traffic and consume system resources.
I dont need interval, i just need retry times if timeouts…
janisk
October 25, 2010, 11:17am
7
retries are done in succession, other try is done after 1 minute, if all probes fail then status is set to down for 1 minute.
ICMP packet size usually is about 64bytes, in other words negligible.
Hi,
I am using this script, run by a scheduler every x seconds.
:local i 0;
{:do {:set i ($i + 1)} while (($i < 2) && ([/ping 10.254.254.250 interval=3 count=1]=0))};
:if ($i=2 && [/ip route get [find comment="Group A"] gateway]=10.254.254.250) do={:log info "Liquid Gateway down";
/ip route set [find comment="Group A"] gateway=10.254.254.255}
:if ($i=2 && [/tool netwatch get [find comment="ECO FIRST HOP"] disabled]=yes) do={/tool netwatch set [find comment="ECO FIRST HOP"] disabled=no}
:if ($i=2 && [/ip route get [find comment="Group B"] gateway]=10.254.254.250) do={ /ip route set [find comment="Group B"] gateway=10.254.254.255}
:if ($i=2 && [/ip route get [find comment="MailServer"] gateway]=10.254.254.250) do={ /ip route set [find comment="MailServer"] gateway=10.254.254.255}
Basically, if 2 pings fail, , a whole sequence of events occur. You can also set the interval and count as you wish.
Hope this helps you.
Brian
Zimbabwe