Netwatch

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 }

Use tool/netwatch and adjust interval and timeout values to suite your needs.

Hello,

I need to do 5 timeouts before run script, in timeout works in time that the ping its lose.

Hello,

Any help please?

Thanks

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.

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…

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