Sat Aug 26, 2023 7:31 pm
So I took a script from the forum, analized it and modified it to my needs and couldn't make it work. Then, I found out why:
Under Simple Queues, EACH static IP queue type is using "default-small" under Advanced.
In Total > Total Queue Type, was using "default-small", but Total Statistics was all 0 "zeros". Once I changed the "Total Queue Type" to "default", Total Statistics started to come to life and "total-bytes" in the script worked. Sometimes we overlook the simplest things. I think it goes straight to "default-small" when adding simple queues.
Here's the working script:
/queue simple
:local totb;
:for r from= 2 to= 254 do= {
:if ([find target="192.168.1.".$r."/32"] != "") do= {
:set $totb [get [find target="192.168.1.".$r."/32"] total-bytes]
:if ($totb > 500000000) do= {
:log info ("Found heavy user 192.168.1.".$r)
:log info $totb
set max-limit= "1M/5M" [find target="192.168.1".$r."/32"]
} else={
:log info ("End of sweep")
}
As I mentioned in my previous post, I'm fairly new to rOS and surely a newbie for scripting but I'm proud to achieve a solution. I wanted a script to check only downloaded bytes originally but since my provider checks my total combined transfer, I reckon I should do the same in the script thus making it simpler.
Perhaps another newbie can benefit from this post and script :)
Thanks to all.