Community discussions

MikroTik App
 
Yokodzun
just joined
Topic Author
Posts: 1
Joined: Sun Dec 11, 2022 1:01 pm

What exactly does bound=1 status mean in scripting?

Sun Dec 11, 2022 1:32 pm

Hi guys, I am implemented simple WAN failover on my hp ac^2 via "check-gateway=ping". As both my uplink require obtaining IP via DHCP, I wrote some scripts to update the static default rote (check-gateway not available for routes received from dhcp-client), and all worked fine. But I want to send a notification when the uplink is switched, so I added a simple fetch request:
:if ($bound=1) do={ /ip route set [/ip route find where comment="GPON"] gateway=$"gateway-address" disabled=no} else={/tool fetch mode=https url="https://domain.tld/hooks/blablabla" http-method=post http-header-field="Content-Type: application/json" http-data="{\"text\":\"Internet switched to the SAT\"}"}
:if ($bound=1) do={/tool fetch mode=https url="https://domain.tld/hooks/blabla" http-method=post http-header-field="Content-Type: application/json" http-data="{\"text\":\"Internet switched to the GPON\"}"}
When GPON goes down, dhcp-client transitions to state "searching" and I got the notification.
But when connections are restored, the default route is updated but the notification wasn't sent.

So I can't figure out is a scrip syntax problem or if I don't understand correctly what exactly bound=1 means.

I will be thankful for your advice.

Who is online

Users browsing this forum: elbob2002, petardo and 20 guests