Configure Netwatch on a Mikrotik
Created: 2023-05-23 21:01:18 | Last modified: 2023-05-23 21:03:58
Access: Read | Views: 15 | Rating: N/A | Tags:
Configure Netwatch on a Mikrotik to monitor and log a connection via Ping
Use this when wanting to log when a Mikrotik connection to a destination comes up or drops. This will create a log entry in the Mikrotik "info" log that will show when a connection initially comes up, and then when it drops.
Step-by-step guide
- Connect into the Mikrotik
- Navigate to Tools > Netwatch
- Click the '+' symbol
- Set the IP address of the remote destination as the host: ie, 8.8.8.8
- Set your interval. If you want a long term ping, probably once every 30 or 60 is fine. If you are currently troubleshooting, you may want to set this to 1 so you catch any packet loss.
- Click on the Up tab and enter the below code. Adjust the IP in this message to match the destination you are testing
:log info "Ping to 8.8.8.8 successful"
- Click on the Down tab and enter the below code. Again, adjust the IP in this message to match the destination you are testing. Click Ok
:log info "Ping to 8.8.8.8 failed"
- Open the Log. You should now see at least one entry for the connection from Netwatch. Netwatch will only create a log when the status of the connection changes between up and down.
- If you want to check all instances of the status change in the log, select the Filter button, change the filter to: Topics > Contains > script
- This will filter down to all instances of scripts that have generated logging events. If you have other scripts generating logging events, you may want to adjust the Netwatch messages to be more specific for filtering purposes.