Code: Select all
:local HOST "192.168.1.1"
:local PINGCOUNT "10"
:local INTF "sfp-sfpplus1"
:local DELAY "3s"
:delay 10s
:if ([/ping $HOST interval=1 count=$PINGCOUNT] = 0) do={
:log error "Interface $INTF is down, restarting..."
/interface ethernet set $INTF auto-negotiation=no
:delay $DELAY
/interface ethernet set $INTF auto-negotiation=yes
:log warning "$INTF restart complete."
} else={
:log info "$INTF is working.";
}
Above works in scripting and scheduler
Code: Select all
:local INTF "sfp-sfpplus1"
:local DELAY "3s"
:log error "Interface $INTF is down, restarting..."
/interface ethernet set $INTF auto-negotiation=no
:delay $DELAY
/interface ethernet set $INTF auto-negotiation=yes
:log warning "$INTF restart complete."
These lines won't work in Netwatch, and I don't know why.
Only seen "Interface sfp-sfpplus1 is down, restarting..." in logging.
RB5009 RouterOS 7.2