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.
: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"]}
if (($pingsofone<1)&&($pingsoftwo<1)
) ???
“if if” ?
ip address enabled [find comment=rezerv]
enabled ???
ip address disabled [find comment=rezerv]
disabled ???
You can not create script putting random words at random randomness…
{
: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) and ($pingsoftwo < 1) ) do={
/ip address enable [find where comment="rezerv"]
}
:if ( ($pingsofone > 1) or ($pingsoftwo > 1) ) do={
/ip address disable [find where comment="rezerv"]
}
}
there was a copy error
: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"]}
ty, Slava Ukraine!