netwatch for two IPs
Posted: Mon May 23, 2022 4:08 pm
Hello. Unfortunately netwatch in Mikrotik can only ping one IP address. Therefore, I ask for help to write a script that will allow you to ping two IP addresses. If at least one of them is available, then disable the IP, if both are not available, then enable the IP.
I tried to do it but it doesn't work.
I tried to do it but it doesn't work.
Code: Select all
:local ipone "10.10.1.254";
:local iptwo "10.10.1.8";
:local pingsofone [ping $ipone count=3];
:local pingsoftwo [ping $iptwo count=3];
if (($pingsofone<1)&&($pingsoftwo<1)) do={/ip address enable [find comment="rezerv"];};
if (($pingsofone>1)||($pingsoftwo>1)) do={/ip address disable [find comment="rezerv"]}