MikroTik ( проверка досупности IP, перезапуск PoE или USB )
MikroTik script [ проверка доступности ping ]
Проверка осуществляется в планировщике [ scheduler] скрипт для ввода в терминале, в конце есть ссылка на видео по практеке
Пример скрипта МикроТик Router OS , по отключение PoE ether5
/system scheduler
1. проверка доступности роутера (192.168.1.1)
add interval=4m name="ping AP221M4" on-event=":local pingresultA [/ping 192.168.1.1 count=3]; :if (\$pingresultA <= 0) do= {:interface ethernet poe set ether5 poe-out=off; :delay 15s; :interface\ \_ethernet poe set ether5 poe-out=forced-on;};\r\ \n" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup
2. проверка доступности модема (192.168.8.1)
add interval=5m name="ping modem" on-event=":local pingresultA [/ping 192.168.8.1 count=3]; :if (\$pingresultA <= 0) do= {:interface ethernet poe set ether5 poe-out=off; :delay 15s; :interface et\ hernet poe set ether5 poe-out=forced-on;};" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup
3. проверка доступности google dns сервера [ всегда можно заменить на другой ] (8.8.8.8)
add interval=5m name="ping ya.ru" on-event=":local pingresultA [/ping 8.8.8.8 count=3]; :if (\$pingresultA = 0) do= {:interface ethernet poe set ether5 poe-out=off; :delay 15s; :interface ethern\ et poe set ether5 poe-out=forced-on;};" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup
4. перезагрузка роутера 1 раз в неделю
add interval=1w name=reboot on-event=":system reboot" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=oct/19/2018 start-time=06:39:44
Пример скрипта МикроТик Router OS , по отключение USB Power-Reset
/system scheduler
1. проверка доступности google dns сервера [ всегда можно заменить на другой ] (8.8.8.8)
add interval=1m30s name="modem usb" on-event=":local pingresultA [/ping 8.8.8.8 count=3]; :if (\$pingresultA = 0) do= {:system routerboard usb power-reset duration=5s;};" policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup
Видео - Как написать и установить скрипт в микротик RouterOS