Hi,
I want to make a script that monitors one specific IP and if I ping this IP the script will run. I tried some things but they never worked.
Thanks for any help on the subject.
Hi,
I want to make a script that monitors one specific IP and if I ping this IP the script will run. I tried some things but they never worked.
Thanks for any help on the subject.
Why make a script ? “Netwatch” will do that for you…
Tools > Netwatch
Then define some “targets” and what test you want to run (eg. regular ICMP or TCP-con or something)
Then define “action” what to do when “Up” and/or “Down” (you can past a script right there)
I am familiar with netwatch. I will clarify better what I need. For example, I set a Veth on my MK with IP 10.1.1.1 after that I am going to ping this IP from my PC and I want to activate something with that ping. So I need to make a script that will watch that IP and if its sees ICMP traffic it will execute.
Netwatch will allow you to :
Note: My netwatch scripts recheck multiple times when an IP stops pinging b4 it runs a script. I do this to allow for false no-pings such as a network had a 10-second glitch where nothing passes for 10 to 180 seconds. After multiple ping retries ( 10 to 60 seconds ) , then my script runs.
It works , I use this myself.
North Idaho Tom Jones
the user explained himself well, I don’t know how you don’t understand it…
he wants to run a script when the RouterBOARD sees an ECHO request packet from any IP to IP 10.1.1.1 pass through it
Create one rule like this, an on scheduler count if the rule is triggered at least once.
I do not do all the code, but you can start from this “idea”.
/ip firewall raw
add action=log chain=prerouting comment="CHECK THIS" dst-address=10.1.1.1 icmp-options=8:0-255 protocol=icmp
Other way can be used, for example add to one address-list the IP that send the echo request, etc.
There is not only one way for do this.
But for sure the “ping” must pass inside the routerboard for detect something.
hmmm,
re: … ping this IP the script will run … ?
Some clarification is needed to fully understand what is wanted.
---- which is desired re this post —
#1 is pretty easy using Netwatch
#2 may require some programming tricks that I don’t know. If I was trying to run a script on a 2’nd mikrotik , I think I would do something else closer to one of possible methods below:
you really still don’t get it?
The title of the topic is extremely clear: “Run script when ping on specific IP is detected”
I wrote it clearly, maybe it’s not the best English…
«he wants to execute a script when the RouterBOARD sees an ECHO request packet coming from any IP, directed to the IP 10.1.1.1»
Thanks for your help, I needed that push that you gave me. Its working