automated rate boundaries to user-manager accounts.

This has been described and published in a number of locations now however I’d like to publish a duplicate here also in the occurrence that anyone else has further recommendations on upgrades for the program, or any further concerns.

Although I never use it much myself, many Mikrotik customers would be acquainted with the “user-manager” program designed by mikrotik as an “all-in-one” hot spot remedy for small-medium sets up.

Many of the features in this are computerized, however not the inclusion of per-account amount boundaries, which would normally be depending on the program bought. Instead most websites opt to use a predetermined rate value on a per wireless router base. An substitute choice to this would be to put different customers in different IP regularly and installation a rate-limited line shrub according to that.

I was expected to develop a program for use on the primary user-manager mikrotik, that would allow records to be allocated a amount restrict depending on the program someone had bought. Once set, this rate value continues to be the same.

Although this is appears to be like quite easy, there happens to be lot of perform stored in having something like this computerized, departing you to get again to operating day to day projects rather than having to either restrict all customers to the same rate or more intense, keep one eye on your person record to get any recently designed accounts!

With that I thoughts I composed the following primary program to allow recently designed records to be allocated a rate-limit depending on the program they bought.

You can change the to go with your own alternatives and remodel this to your preference.

In this example you can see that, if I person bought a $30 program (credit-price=30000) they would be allocated a amount restrict of 512k/128k, whereas a $90 buy would get a 2M/128k restrict.

01#Script to add rate limit's to newly created user-manager accounts.
02#Written by Andrew Cox | http://www.mikrotik-routeros.com
03 
04:local counter
05:local check
06 
07#Loop through all users in user-manager
08:foreach counter in=[/tool user-manager user find] do={
09 
10#Check to see if comment contains "RLA" (short for 'rate limit added'). If it doesn't, this account hasn't had a rate limit set yet.
11#We only check the first 3 characters, this means you can continue to use the comment field for whatever you like so long as you leave the 'RLA' untouched (if present)
12:set check [:pick [/tool user-manager user get $counter value=comment] 0 3]
13:if ($check="RLA") do={
14 
15#Has RLA, rate limit is already set so ignore
16 
17} else={
18 
19#Doesn't have RLA Set rate-limit based on initial purchase pricing
20:if ([/tool user-manager user get $counter credit-price] ="30000") do={/tool user-manager user set $counter rate-limit="512k/128k" comment="RLA"}
21:if ([/tool user-manager user get $counter credit-price] ="60000") do={/tool user-manager user set $counter rate-limit="1M/128k" comment="RLA"}
22:if ([/tool user-manager user get $counter credit-price] ="90000") do={/tool user-manager user set $counter rate-limit="2M/128k" comment="RLA"}
23}  }
Title : automated rate boundaries to user-manager accounts.
Description : This has been described and published in a number of locations now however I’d like to publish a duplicate here also in the occurrence that ...

0 Response to "automated rate boundaries to user-manager accounts."

Posting Komentar