Mikrotik-Xmit-Limit and Freeradius

Hi All

Is anyone using Mikrotik-Xmit-Limit with freeradius to limit a customers upload/download limits (per month/day) etc? If so, would you care to share the Freeradius mysql counter code - i’ll purchase it if needs be.

Regards

LOL, after 60 minutes of searching, i rephased the question after posting and ended up with this:

Note: This code is not 100% correct, as from looking at it, it will return null the fist time its used as no accounting packets are present - select statement needs updating to return 0 if null.

sqlcounter downloadbytecounter {
counter-name = Mikrotik-Xmit-Limit
check-name = Mikrotik-Xmit-Limit
reply-name = Mikrotik-Xmit-Limit
sqlmod-inst = sql
key = User-Name
reset = never
query = “SELECT SUM(acctoutputoctets) FROM radacct WHERE
username=‘%{%k}’”
}



In sites-available/default

authorize {
downloadbytecounter

HI
I am trying to set Mikrotik Limit uptime in FreeRADIUS. any ideas how freeRADIUS does that?

At the query line, try using this SQL statement:

query = "SELECT IFNULL(SUM(acctoutputoctets),0) FROM radacct WHERE username='%{%k}'"

My advice is to use a single line for the SQL query.