tsatasos
12-06-15, 20:59
Έχω φτιάξει ένα HotSpot με κανονικούς και trial users.
Η απαίτηση είναι ο trial user να έχει περιορισμό 1GB (μια κ έξω) και να γίνει reset στους counters κάθε 30 ημέρες.
Αυτό το έκανα με το παρακάτω script το οποίο έβαλα να τρέχει κάθε 1 λεπτό:
#Download limit in Bytes
:local downquotamb "1073741824"
### Do not modify anything below this line ###
:local downquota [$downquotamb]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
:log info "Logged out $username - Reached download quota"
}}
Και το παρακάτω για reset στους counters που τρέχει κάθε 30 ημέρες:
ip hotspot user reset-counters
http://wiki.mikrotik.com/wiki/Add_a_data_limit_to_trial_hotspot_users
Όλα καλά μέχρι εδώ.
Επιπλέον τώρα, θέλω να έχω και στατιστικά για τους trial (και τους κανονικούς) users (γραφήματα ανά ημέρα/εβδομάδα/μήνα).
Ξέρει κανείς αν γίνεται?
Ευχαριστώ
- - - Updated - - -
Ανακάλυψα ότι ο περιορισμός στον όγκο που βάζει το script, επηρεάζει ΟΛΟΥΣ τους χρήστες κ όχι μόνο τους Trial...
Καμία λύση πάνω σε αυτό?
- - - Updated - - -
Ότι Script βρήκα που κ καλά πιάνει μόνο τους Trial δεν παίζει καν.
π.χ. αυτό:
#Download limit in MB
:local downquotamb 50
### Do not modify anything below this line ###
:local downquota [$downquotamb * 1000 * 1000]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
:if ( $username=”T-$macaddress”) do={
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
}
:log info "Logged out $username - Reached download quota"
}}
http://www.mikrotik-routeros.com/2012/10/add-a-data-limit-to-trial-hotspot-users/
Η απαίτηση είναι ο trial user να έχει περιορισμό 1GB (μια κ έξω) και να γίνει reset στους counters κάθε 30 ημέρες.
Αυτό το έκανα με το παρακάτω script το οποίο έβαλα να τρέχει κάθε 1 λεπτό:
#Download limit in Bytes
:local downquotamb "1073741824"
### Do not modify anything below this line ###
:local downquota [$downquotamb]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
:log info "Logged out $username - Reached download quota"
}}
Και το παρακάτω για reset στους counters που τρέχει κάθε 30 ημέρες:
ip hotspot user reset-counters
http://wiki.mikrotik.com/wiki/Add_a_data_limit_to_trial_hotspot_users
Όλα καλά μέχρι εδώ.
Επιπλέον τώρα, θέλω να έχω και στατιστικά για τους trial (και τους κανονικούς) users (γραφήματα ανά ημέρα/εβδομάδα/μήνα).
Ξέρει κανείς αν γίνεται?
Ευχαριστώ
- - - Updated - - -
Ανακάλυψα ότι ο περιορισμός στον όγκο που βάζει το script, επηρεάζει ΟΛΟΥΣ τους χρήστες κ όχι μόνο τους Trial...
Καμία λύση πάνω σε αυτό?
- - - Updated - - -
Ότι Script βρήκα που κ καλά πιάνει μόνο τους Trial δεν παίζει καν.
π.χ. αυτό:
#Download limit in MB
:local downquotamb 50
### Do not modify anything below this line ###
:local downquota [$downquotamb * 1000 * 1000]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
:if ( $username=”T-$macaddress”) do={
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
}
:log info "Logged out $username - Reached download quota"
}}
http://www.mikrotik-routeros.com/2012/10/add-a-data-limit-to-trial-hotspot-users/