Sql counter

Randeep randeep123 at gmail.com
Sat Jun 20 09:53:02 CEST 2015


Hi,

I'm trying to set maximum data limit for a user.

In the /etc/raddb/sql/mysql/counter.conf

I have created this.

sqlcounter testcounter {
counter-name = Max-Data-Used
                check-name = Max-Data
                sqlmod-inst = sql
                key = User-Name
                reset = daily
reply-message = “You have reached your bandwidth limit” sqlmod-inst = sql
query = “SELECT SUM(acctinputoctets) + SUM(acctoutputoctets) FROM radacct
WHERE username=’%{%k}'” }
}

When I checked the accounting flow, the flow is as follows,

New acct request -> Preacct ->accounting -> Send response

So I tried to put the testcounter in

/etc/raddb/sites-enabled/default

In preacct and accounting blocks.

But it gave me errors

Sat Jun 20 13:12:54 2015 : Error: /etc/raddb/sites-enabled/default[389]:
"SQL Counter" modules aren't allowed in 'accounting' sections -- they have
no such method.
Sat Jun 20 13:12:54 2015 : Error: /etc/raddb/sites-enabled/default[382]:
Errors parsing accounting section.

Also I'm confused about the parameters in the testcounter.

We have to declare these two variables anywhere?
counter-name = Max-Data-Used
check-name = Max-Data

Where we can specify the max data limit to the user.

Please advice.
Also please give some links if you which I can refer.


-- 
Randeep
Mob: +919447831699[kerala]
Mob: +919880050349[B'lore]
http://twitter.com/Randeeppr
http://in.linkedin.com/in/randeeppr


More information about the Freeradius-Users mailing list