Community discussions

MikroTik App
 
pacmanfan
just joined
Topic Author
Posts: 14
Joined: Mon Jun 30, 2008 7:05 am

Netwatch to disable a static route

Tue Jul 15, 2008 7:49 am

Hi,

I need a script that will use netwatch to check the status of a gateway every 30 seconds, and disable a static route if the gateway is unreachable. Every 30 seconds it should check again, and re-enable the route if the gateway is reachable again. This is for connection failover from cable to DSL. I'll be glad to pay for a script like this if it hasn't been done before. Any help is appreciated!

Thanks!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6196
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Netwatch to disable a static route

Tue Jul 15, 2008 8:10 am

It's easy. Add scheduler tp run every 30 seconds and add script similar to this one
:if ([/ping xx.xx.xx.xx count=3] = 3) do={
     <enable gateway here>
} else={
     <disable gateway here>
}
 
User avatar
ashish
Long time Member
Long time Member
Posts: 550
Joined: Mon Feb 12, 2007 5:50 am
Location: Virginia, USA.

Re: Netwatch to disable a static route

Tue Jul 15, 2008 8:33 am

Hi MRZ,
I need script for following event.

if received byte per second=1 Mbps of ether1, than the router shoud send mesage to customer.

I know the How to send sms but confused to write script.
- AP - ASHISH PATEL - 757 309 0236 -
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6196
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Netwatch to disable a static route

Tue Jul 15, 2008 9:25 am

/interface monitor-traffic ether1 once do={ 
       :if ($"received-bits-per-second" = 1000000) do={
               < send sms>
       }
}
f received byte per second=1 Mbps of ether1
So you need mega BITS or BYTES? If bytes then you will also have to convert received-bits-per-second to bytes nad then compare
 
dragan
just joined
Posts: 2
Joined: Sat Jul 26, 2008 1:34 pm

Re: Netwatch to disable a static route

Sat Jul 26, 2008 1:56 pm

It's easy. Add scheduler tp run every 30 seconds and add script similar to this one
:if ([/ping xx.xx.xx.xx count=3] = 3) do={
     <enable gateway here>
} else={
     <disable gateway here>
}
if possible can anyone show me step by step with photos because its very difficult for me to achive that but i dont want ping gateway to control the link example ping http://www.google.com(74.125.39.104) Every 30 seconds it should check again , and re-enable the route if the second gateway if the http://www.google.com(74.125.39.104) isreachable again
 
kcavery001
just joined
Posts: 9
Joined: Mon Feb 22, 2021 5:59 am

Re: Netwatch to disable a static route

Tue Feb 23, 2021 9:17 am

/interface monitor-traffic ether1 once do={ 
       :if ($"received-bits-per-second" = 1000000) do={
               < send sms>
       }
}
f received byte per second=1 Mbps of ether1
So you need mega BITS or BYTES? If bytes then you will also have to convert received-bits-per-second to bytes nad then compare
Sir what if ISP has high ping and/or slow internet connection and not totally down. how to send also notification via sms sir?

Who is online

Users browsing this forum: Jotne and 19 guests