Restart wlan interface in event of ping failure.

Hello, We have some P2MP links that occasionally go unresponsive or high packet loss. Rather than using a watchdog timer on an IP (Sometimes the unit will hang on restart) im monitering ive decided to try making my very first script. It works as intended:
I have a netwatch watching a local IP “10.0.0.2” If that connected client should stop being reachable it executes the following script:

:if ([/ping 10.0.0.2 interval=1 count= 45] <30) do={ log info “disabled Wlan1” ; /interface disable wlan1 ; delay 15 ; /system script run wlan1_start

}

and I made a second script to activate after the delay command in the first;

log info “startingWlan1” ; /interface enable wlan1

Try Netwatch http://wiki.mikrotik.com/wiki/Netwatch. You can change interval and timeout.
And On Down event run

/interface disable wlan1; :delay 5; /interface enable wlan1; :log info "wlan1 restarted"

But it is temporary solution.
Set for wlan1 adaptive-noise-immunity=ap-and-client-mode.
Try Scan and Frequency usage to set optimal frequency.
Etc.

I want it watching for high packet loss too, not just downtime. Likewise I dont want it pre-maturely thinking it’s down just because my watch ip decides he wants to fire up a torrent and he gets a few packets dropped as a result.


This is temporary. Eventually all these subs will get migrated to our licenced 3.65 moto gear and get off this 2.4ghz poo and i wont have to worry about writing scripts for misbehaving AP’s.