I want to se sqlcounters to count bytes transferred from clients so that i manage quota.
Aiming this i configured the following counter:

sqlcounter bytesQuota {
        counter-name = traffic_quota
        check-name = Max-Traffic
        reply-name = Session-Traffic-Limit
        sqlmod-inst = mysqldb
        key = User-Name
        reset = hourly
        query = "SELECT SUM(acctinputoctets + acctoutputoctets) FROM radacct WHERE UserName='%{%k}'"
}

My first problem is that the Session-Traffic-Limit (from the redback dictionnary) is not returned. I can't see it neither in the output of radtest nor with radsniff.
Yet, looking at the output of radiusd -X i can see it's correctly understood by freeradius:

rlm_sqlcounter: Check item is greater than query result
rlm_sqlcounter: Authorized user scott, check_item=12000, counter=10891
rlm_sqlcounter: Sent Reply-Item for user scott, Type=Session-Traffic-Limit, value=12792
++[bytesQuota] returns ok

Does anyone has a clue?

Alexandre Chapellon a écrit :
You're right, adding the name of my sqlcounter in the instantiate section lake it works.
thx :)

Alan DeKok a écrit :
Alexandre Chapellon wrote:
  
whenever i launch freeradius -X I get the folloawing error:
/etc/freeradius/users[205]: Parse error (check) for entry scott: Invalid
octet string "101" for attribute name "Max-Traffic"
    

  The modules are initialized in *order*.  The sqlcounter module creates
the attributes on the fly.  But... it can't do this if it hasn't been
run yet.

  
Line 205 is the line where user scott is defined in users files.
I have tryed setting up my own dictionnary (which i think shouldn't be
needed) with the Max-Traffic attribute defined as interger

VENDOR ME
ATTRIBUTE       Max-Traffic     1       integer
    

  That isn't the correct dictionary file format, but it's not relevant,
either.

  
But that doesn't help. I have read all over the web that sqlcounter with
mysql are considered as stable enough for production , so am quite
surprised of this issue...
Any idea?
    

  List "sqlcounter" in the "instantiate" section.  It will be
initialized before the "users" file is read.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

  

- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html