Community discussions

MikroTik App
 
Diamont
just joined
Topic Author
Posts: 19
Joined: Sun Aug 18, 2013 6:48 pm

Netwatch Script

Fri Jul 15, 2016 1:20 pm

Hi. I would like to do some action when remote host is down. This host has a dynamic IP and DDNS service. The problem is that Netwatch in Mikrotik resolves IP only once when you add a new host. I need the script which will resolve and ping remote host every 1 minute and do some action if it`s down.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Netwatch Script

Fri Jul 15, 2016 4:22 pm

I believe that command "ping host.domain.tld" resolves ip each time. You can use it in your scripts...
 
Diamont
just joined
Topic Author
Posts: 19
Joined: Sun Aug 18, 2013 6:48 pm

Re: Netwatch Script

Fri Jul 15, 2016 5:39 pm

Here is my script:

:local i 0; {:do {:set i ($i + 1)} while (($i < 2) && ([/ping domain.com interval=1 count=1]=0))};
        :if ($i=2) do={:log info "Main AP Down"; 
         /interface disable ether5}

Who is online

Users browsing this forum: WarlorZ and 7 guests