Page 1 of 1

Netwatch failover script

Posted: Thu Oct 22, 2015 9:07 am
by mizeraj
Hello, i have some problemas with netwatch script (it doesn't woark, actually):
/ip route set [find comment="ISP1"] distance=1; 
/ip route set [find comment="ISP2"] disabled=yes;
:delay 5;
/ip  firewall  connection  remove  [find  dst-address=95.213.163.196];
I have ROS 6.32.3 and am i missing something? Mayby incorrect script syntax?

And one more question: is there a way to test scripts in some virtual environment, without actually testing them on running device?

Re: Netwatch failover script

Posted: Fri Oct 23, 2015 4:59 am
by scampbell
If you create you netwatch scripts in /system script with name like "up" or "down" you can then run them and see if they work.

Then in /tool netwatch just specify the name of the script in the up and down menu's .

EXAMPLE:

/system script
add name=up owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
"/log error \"ip up\""
add name=down owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
"/log error \"ip is down\""

/tool netwatch
add down-script=down host=8.8.8.8 up-script=up

Re: Netwatch failover script

Posted: Fri Oct 23, 2015 2:10 pm
by mizeraj
Ohhh... It seems i misunderstood those big textboxes in /tool netwatch winbox window - i thought they should contain the script itself... Thank you.

Re: Netwatch failover script

Posted: Tue Oct 27, 2015 3:20 am
by scampbell
Both ways work - I just like using seperate scripts so you can test them :-)