Community discussions

 
mizeraj
just joined
Topic Author
Posts: 7
Joined: Wed Mar 19, 2014 10:29 am

Netwatch failover script

Thu Oct 22, 2015 9:07 am

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?
 
scampbell
Trainer
Trainer
Posts: 457
Joined: Thu Jun 22, 2006 5:20 am
Location: Wellington, NZ
Contact:

Re: Netwatch failover script

Fri Oct 23, 2015 4:59 am

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
MTCNA, MTCWE, MTCRE, MTCTCE, MTCSE, MTCINE, Trainer
___________________
Mikrotik Distributor - New Zealand
http://www.campbell.co.nz
 
mizeraj
just joined
Topic Author
Posts: 7
Joined: Wed Mar 19, 2014 10:29 am

Re: Netwatch failover script

Fri Oct 23, 2015 2:10 pm

Ohhh... It seems i misunderstood those big textboxes in /tool netwatch winbox window - i thought they should contain the script itself... Thank you.
 
scampbell
Trainer
Trainer
Posts: 457
Joined: Thu Jun 22, 2006 5:20 am
Location: Wellington, NZ
Contact:

Re: Netwatch failover script

Tue Oct 27, 2015 3:20 am

Both ways work - I just like using seperate scripts so you can test them :-)
MTCNA, MTCWE, MTCRE, MTCTCE, MTCSE, MTCINE, Trainer
___________________
Mikrotik Distributor - New Zealand
http://www.campbell.co.nz

Who is online

Users browsing this forum: No registered users and 9 guests