Difference between revisions of "Netwatch Script Reboots MikroTik"
| (10 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
http://forum.mikrotik.com/viewtopic.php?t=56138  | http://forum.mikrotik.com/viewtopic.php?t=56138  | ||
| − | First - what this does:  | + | '''First - what this does:'''  | 
| − | * It will ping test an IP address. This   | + | * It will ping test an IP address. This is a remote IP address (such as the Base Station IP 192.168.0.10)  | 
| − | * If the remote IP address does not answer any pings for   | + | * If the remote IP address does not answer any pings for 5 minutes, then the router reboots.  | 
'''To set it up - follow these steps using Winbox:'''  | '''To set it up - follow these steps using Winbox:'''  | ||
| − | + | '''1.''' Go to System>Scripts  | |
Click on the red "+"  | Click on the red "+"  | ||
Give your script a Name (in my example I will use "NetWatchBoot-192.168.0.10"  | Give your script a Name (in my example I will use "NetWatchBoot-192.168.0.10"  | ||
| − | + | '''2.''' In the Source: area paste in the entire line below: '''WITHOUT THE QUOTES " "'''  | |
| − | :if ([/ping 192.168.0.10 interval=5 count=60] =0) do={  | + | |
| + | |||
| + | ":if ([/ping 192.168.0.10 interval=5 count=60] =0) do={  | ||
log info "my ping watchdog is down" ; /system reboot  | log info "my ping watchdog is down" ; /system reboot  | ||
| − | }  | + | }"  | 
| − | + | ||
| + | '''3.''' Click the Apply button - then click the OK button  | ||
| + | |||
| + | |||
| + | Here is the Logic... The above sample will ping 192.168.0.10 for 5 intervals of 60 seconds = 5 minutes  | ||
| + | If it does not reach the the assigned script NetWatchboot IP address, the MikroTik will reboot  | ||
'''At this time - we have a script - it is not running or active yet.'''  | '''At this time - we have a script - it is not running or active yet.'''  | ||
| − | + | '''1.''' Go to Tools>Netwatch  | |
Click on the red "+"  | Click on the red "+"  | ||
On the Host tab - type in 192.168.0.10  | On the Host tab - type in 192.168.0.10  | ||
| − | Set interval for   | + | Set interval for 00:01:00 min  | 
| + | |||
| + | '''2.''' Click on the Down tab  | ||
| + | Paste in the line below: '''WITHOUT THE QUOTES " "'''  | ||
| + | |||
| + | |||
| + | "/system script run NetWatchBoot-192.168.0.10"  | ||
| + | |||
| − | + | '''3.''' Click the Apply button - then click the OK button  | |
| − | |||
| − | |||
| − | |||
'''Reboot the Router from System>Reboot>Yes'''  | '''Reboot the Router from System>Reboot>Yes'''  | ||
Latest revision as of 17:16, 6 February 2017
Mikrotik Netwatch script on AP for auto reboot ...
http://forum.mikrotik.com/viewtopic.php?t=56138
First - what this does:
- It will ping test an IP address. This is a remote IP address (such as the Base Station IP 192.168.0.10)
 - If the remote IP address does not answer any pings for 5 minutes, then the router reboots.
 
To set it up - follow these steps using Winbox:
1. Go to System>Scripts Click on the red "+" Give your script a Name (in my example I will use "NetWatchBoot-192.168.0.10"
2. In the Source: area paste in the entire line below: WITHOUT THE QUOTES " "
":if ([/ping 192.168.0.10 interval=5 count=60] =0) do={
log info "my ping watchdog is down" ; /system reboot
}"
3. Click the Apply button - then click the OK button
Here is the Logic... The above sample will ping 192.168.0.10 for 5 intervals of 60 seconds = 5 minutes
If it does not reach the the assigned script NetWatchboot IP address, the MikroTik will reboot
At this time - we have a script - it is not running or active yet.
1. Go to Tools>Netwatch Click on the red "+" On the Host tab - type in 192.168.0.10
Set interval for 00:01:00 min
2. Click on the Down tab Paste in the line below: WITHOUT THE QUOTES " "
"/system script run NetWatchBoot-192.168.0.10"
3. Click the Apply button - then click the OK button
Reboot the Router from System>Reboot>Yes