I need to make a Fair User Policy for my customers.
Default all customers will be getting 2M Download Speed.
There will be packages like example: 3Mbps with 10GB, 5Mbps with 30GB, 10Mbps with 50GB, etc..
Once the customer reaches to given allowance/capacity reduce speed to default (2M). Again customer can increase speed by purchase of allowance/capacity.
:local uList [/ip hotspot user find profile=$limitedProfile]
:foreach u in=$uList do={
:local traf ([/ip hotspot user get $u bytes-in] + [/ip hotspot user get $u bytes-out])
:local uActive [/ip hotspot active find user=[/ip hotspot user get $u name]]
:if ([:len $uActive] != 0) do={
:set traf ($traf + [/ip hotspot active get $uActive bytes-in] + [/ip hotspot active get $uActive bytes-out])
}
:put (“User (” . [/ip hotspot user get $u name] . ") traf: " . $traf)
:if ($traf > $trafLimit) do={
/ip hotspot user set $u profile=$limitedSlowProfile
:put (“User (” . [/ip hotspot user get $u name] . “) mencapai batas FUP yg ditentukan”)
:if ([:len $uActive] != 0) do={
/queue simple set max-limit=256k/256k [find name=[/ip hotspot user get $u name]]
#/ip hotspot active remove $uActive #Hapus tanda pagar jika anda ingin User yg active dikeluarkan dari jaringan
:put (“User (” . [/ip hotspot user get $u name] . “) kecepatannya akan diturunkan”)
}
:log warning (“User (” . [/ip hotspot user get $u name] . “) sudah melebihi batas FUP”)
}
}
}