how can i limit users according to amount of download ?

how can i limit users according to amount of download ?
i have 15 users some of them download alot and i want to limit them after they reach 6 gig per day
my ip for users 10.0.0.1 can anyone please help and explain steps because i am new at this

please

are you using hotspot , broadband or DHCP …?

Try active Hotspot on mikrotik and use user manager

Sent from my Sony Xperia Z Ultra using Tapatalk

i use hotspot
i did install user manager i tried limit speed but it only limit download and then remove user

what i want is limit their speed after they download 6 gb for example

user1 speed 4MB he reached 6gb download he now his speed should change to 256k
and next day it repeated

i also tried this script in scheduler

:local traf;
/queue simple
:for i from=1 to= 254 do = {
:if ([/queue simple find target-addresses=(“10.0.0.” . $i)] != “”) do={
:set traf [get [find target-addresses=(“10.0.0.” . $i)] total-bytes]
:if ($traf > 6442450944) do = {
set [find target-addresses=(“10.0.0.” . $i)] max-limit= 32000/256000
}
}
}

didn’t work

And what part of the script did not work?

Please lower the amount (for example to 10 Mb) and run yourself on that interface. The switch on the logging and run a download (or start any Youtube movie).

See what happens, and where it does not work.

take a look at this post. i think is what u want. read the fourth post from “greencomputing”

http://forum.mikrotik.com/t/download-speed-limit-per-connection-after-some-time/58671/1

idid but still not weorking here a screen shot

/queue simple
:for i from=1 to= 254 do = {
:if ([/queue simple find target-addresses=(“10.0.0.” . $i)] != “”) do={
:set traf [get [find target-addresses=(“10.0.0.” . $i)] total-bytes]
:if ($traf > 10000) do = {
set [find target-addresses=(“10.0.0.” . $i)] max-limit= 32000/64000
}
}
}

maybe there are some errors in code because it not working in terminal
my os version 6.32.4 on RB750

really no one know?

If there is errors in the script, the terminal could be giving you an error message when you try to run it there.
So what is it saying?

EDIT:
Yeah there were some syntax errors in the script you posted. Some property names also seemed to be wrong/nonexistent, at least on RouterOS v6.35.
Try this:

/queue simple {
    :for i from=1 to= 254 do={
        :local queue [find target=("10.0.0." . $i . "/32")]
        :if ([:len $queue] != 0) do={
            :local traf [get $queue total-bytes]
            :put ("Queue (" . [get $queue target] . ") traf: " . $traf)
            :if ($traf > 10000 && [get $queue max-limit] != "32000/64000") do={
                set $queue max-limit=32000/64000
                :put ("Queue (" . [get $queue target] . ") max-limit set to: 32000/64000")
            }
        }
    }
}

Other than that I know nothing about queues, so I can’t say for sure this will work in your setup.
But in my little test it seemed to work fine. A problem I found was that “target” is a semi-colon separated list if there is more than one address listed, so checking it as a string is very weird. Would it not be easier to just loop through all queues that have a specific name prefix or comment?

i really thank u for looking in to my problem however i tried the script in terminal and it says ( invalid internal item number
) although there r many users now have reached 5 gig

“invalid internal item number”? I have never seen that error before.
Are there multiple queues with the same IP address set as their “target”?

Looking at the picture it seem so. The “client1” queue has the same IP address as “” queue.
Like I said, would it not be easier to loop through the queues? Can we relay on the queues always being named “<hotspot-???>”?

If we can then it is simple to change the script to:

/queue simple {
    :local queueList [find name~"^<hotspot-"]
    :foreach queue in=$queueList do={
        :if ([:len $queue] != 0) do={
            :local traf [get $queue total-bytes]
            :put ("Queue (" . [get $queue name] . ") traf: " . $traf)
            :if ($traf > 10000 && [get $queue max-limit] != "32000/64000") do={
                set $queue max-limit=32000/64000
                :put ("Queue (" . [get $queue name] . ") max-limit set to: 32000/64000")
            }
        }
    }
}

This works by simply looping through all the queues that start with “<hotspot-”. You can change the affected queues by altering the [find] command’s parameters at line 2.

yes there r multi ip same number i did that to make total-bytes work for the same users -i will remove it now and test- but may be as u said loop is easier

the thing is my queue i can’t modfy it so total-bytes wont work i think that because i didn;t put it manual it come from hotspot << sorry for my bad English

here is what happened

You replied before I was done editing my post, read it again.

Ok, so the “total-bytes” property is always 0 for a dynamic queue? Seems like a bug.
The “bytes” property is up and down separated by a slash (/), could just add those together I guess.

So try this:

/queue simple {
    :local queueList [find name~"^<hotspot-"]
    :foreach queue in=$queueList do={
        :local traf [get $queue bytes]
        :local splitPos [:find $traf "/" -1]
        :if ([:len $splitPos] != 0) do={
            :set traf ([:pick $traf 0 $splitPos] + [:pick $traf ($splitPos + 1) 255])
        } else={
            :set traf 0
        }
        :put ("Queue (" . [get $queue name] . ") traf: " . $traf)
        :if ($traf > 10000 && [get $queue max-limit] != "32000/64000") do={
            set $queue max-limit=32000/64000
            :put ("Queue (" . [get $queue name] . ") max-limit set to: 32000/64000")
        }
    }
}

EDIT:
Wait “failure: cannot change dynamic”, so we can’t change the “max-limit” property of a dynamic queue?
Ok that I have no clue about then, try looking in the hotspot manual for that.

yes this is the problem dynamic cannot be changed and i’v been looking for other way but i couldn’t

is there a way ?? this maybe help http://forum.mikrotik.com/t/dynamic-items-unchangeable-why/91225/1 should i downgrade?
87879646.png

i downgrade to 6.30.4 and this what i get now> maybe we could change user profile to another and reduce his speed can u change that in script

As said in that thread, you have to control the Hotspot Users rather than the queues.
The queues are dynamically created and changed when the user is changed.

I just don’t know anything about the Hotspot feature, so I don’t know what values need to be changed.
But looking a little bit at it, it looks like you can set a “User” to use a “User Profile” and the user profile can have a rate-limit. So it should be easy to loop through the users and change their user profile to a user profile that has a rate-limit.