Community discussions

MikroTik App
 
sakretayer
just joined
Topic Author
Posts: 4
Joined: Thu Sep 29, 2011 4:00 pm

automatic decrease of bandwidth after certain limit

Tue Apr 19, 2016 4:16 pm

I use mikrotik broadband and want the system to decrease the users rate automatically if he finished his allowed data. Some one posted it put it didn't work with me. is it possible to do it?

the script did't work is :

:global b1 "5"
:global b2 "10"
/ppp active
:foreach h in=[find] do={
:global pname [get $h name]
:global paddress [get $h address]
:global pprofile [/ppp secret get $pname profile]
:global plimit [/ppp profile get $profile address-list]
/ip hotspot active
:foreach i in=[find] do={
:global name [get $i user]
:global address [get $i address]
:global profile [/ip hotspot user get $name profile]
:global limit [/ip hotspot user profile get $profile on-login]
/queue simple;
:foreach r in=[find dynamic=no] do={
:global namqueue [get $r name]
:global bytes [get $r total-bytes]
:global allbyte [get $r comment]
if ($namqueue =! $name) do={add name=$name comment="0" target=$address max-limit=$limit total=default}
if ($namqueue =! $pname) do={add name=$pname comment="0" target=$paddress max-limit=$plimit total=default}
if ($bytes > 1000) do={
:set $r comment=($bytes+$allbyte)
:reset-counters $r}}}}
:delay 2s
/queue simple;
:foreach m in=[find dynamic=no] do={
:global mlimit ([get $m comment] /1024 /1024 /1024)
:global mname [get $m name]
:global mmax [get $m max-limit]
:global mproflie [/ip hotspot user get $mname profile]
:global mlimit [/ip hotspot user profile get $mproflie on-login]
if (($mlimit < $b1) && ($mmax =! $mlimit)) do={set $m max-limit=$mlimit}
if (($limit > $b1) && ($mlimit < $b2)) do={set $m max-limit=128k/256k}
if ($mlimit > $b2) do={set $m max-limit=1k/1k}
}

Who is online

Users browsing this forum: lurumoney and 21 guests