Community discussions

MikroTik App
 
User avatar
ocgltd
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Sun Sep 02, 2012 12:53 am
Location: Ontario, Canada

Netwatch script to check if plugged in

Sat Nov 30, 2024 3:13 pm

I want my mAP to take an action when I plug another host into a particular port. However, that host runs a firewall so it will not respond to pings /etc. Basically I want to use the link state (running) for a particular port and tell netwatch to use the result of that script to cause the action to happen.

Is this an ok way to use the script feature of netwatch? Or should I just use a script set to run at intervals.
 
jaclaz
Forum Guru
Forum Guru
Posts: 2137
Joined: Tue Oct 03, 2023 4:21 pm

Re: Netwatch script to check if plugged in

Sat Nov 30, 2024 3:59 pm

Netwatch is triggered by a change in the status of pinging <some address>, and the discrimination is only between ping OK and ping NOT OK.

If the pinging always fails, no matter if the ether interface has a connection or not, it won't be triggered, I believe.