Community discussions

MikroTik App
 
ba7abak
newbie
Topic Author
Posts: 45
Joined: Fri Mar 01, 2013 4:34 pm

Script for TX and RX count Zero

Sun Jun 02, 2013 8:38 pm

i need script for Metal 2shpn some time i found wireless card the RX and TX count Zero (0) and the Registration option in wireless peoples access point still connecting i don't know why :(
Image

to repair this problem must restart the Metal , i need some one make to me Script when this problem happen system reboot
 
DanH
just joined
Posts: 11
Joined: Mon Jul 18, 2011 2:13 am

Re: Script for TX and RX count Zero

Sun Jun 02, 2013 9:24 pm

This is for 5 clients on a sector on wireless interface, wlan1.

Change the IPs to those of the client RBs and change wlan1 to your wireless interface.
Add to scheduler to run once on startup.
#AUTO restart stalled sector
#Ping Sector clients
#If no successful pings -> Restart Sector

:local latency
:local runloop true

:while ($runloop =  true) do={
   :delay 20s
   :set latency 0
   :local latency1 [/ping address=172.18.194.6 interval=1000ms count=1];
   :local latency2 [/ping address=172.18.194.14 interval=1000ms count=1];
   :local latency3 [/ping address=172.18.194.22 interval=1000ms count=1];
   :local latency4 [/ping address=172.18.194.30 interval=1000ms count=1];
   :local latency5 [/ping address=172.18.194.86 interval=1000ms count=1];
   
   :set latency ($latency1 + $latency2 +$latency3 + $latency4 + $latency5)

   if ($latency = 0) do={
      :log info "Sector Freeze detected"
      :log info "Sector Disabled"
      interface disable wlan1
      delay 3s
      interface enable wlan1
      :log info "Sector Enabled"
      delay 100s
   }
}
Its not an elegant solution, but i wrote it in 5min a while back and it solved the exact issue you are having.

If you neaten, tweak, come up with something better please share.
 
ba7abak
newbie
Topic Author
Posts: 45
Joined: Fri Mar 01, 2013 4:34 pm

Re: Script for TX and RX count Zero

Mon Jun 03, 2013 12:13 am

Thanx DanaH for help , it must add IPs to those of the client ?? some client's Ips when i make ping in mikrotik give me timeout

and this script make disable & enable or reboot ??
Last edited by ba7abak on Mon Jun 03, 2013 1:23 am, edited 1 time in total.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Script for TX and RX count Zero

Mon Jun 03, 2013 12:54 am

try this

ros code

{
:local bps
/interface monitor-traffic wlan1 interval=2s do={:set bps (rx-bits-per-second)} once
if ($bps < 10) do={system reboot} }

add a scheduller with reboot policy
 
DanH
just joined
Posts: 11
Joined: Mon Jul 18, 2011 2:13 am

Re: Script for TX and RX count Zero

Mon Jun 03, 2013 1:27 am

^^^What he said^^^

But for me rebooting the rb wasn't necessary, just disabling and enabling the interface was enough to get it running again.

Sent from my XT910 using Tapatalk 2
 
ba7abak
newbie
Topic Author
Posts: 45
Joined: Fri Mar 01, 2013 4:34 pm

Re: Script for TX and RX count Zero

Tue Jun 04, 2013 5:04 pm

try this

ros code

{
:local bps
/interface monitor-traffic wlan1 interval=2s do={:set bps (rx-bits-per-second)} once
if ($bps < 10) do={system reboot} }

add a scheduller with reboot policy
i try it and not working with me :(

But for me rebooting the rb wasn't necessary, just disabling and enabling the interface was enough to get it running again.

Sent from my XT910 using Tapatalk 2
your script working but he disable and enable wlan1 all time , when my problem happen disable & enable not working with me must restart i don't know why :(

i try scan option in wireless interface and nothing appears this show me the wlan1 freeze then i restart Metal
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Script for TX and RX count Zero

Tue Jun 04, 2013 6:06 pm

paste in the terminal, and check the outut.

Who is online

Users browsing this forum: necropastor and 14 guests