Check traffic quota / rlm_sqlcounter
Alexander
alexander_austria at yahoo.com
Wed Apr 7 17:09:18 CEST 2010
--- On Wed, 4/7/10, Alan DeKok <aland at deployingradius.com> wrote:
>
> a) store traffic data in the DB when an accounting packet
> is received
>
Accounting to DB is already working.
> b) check that on loging
>
> You shouldn't need to use sqlcounter. Just a
> plain SELECT will do it.
>
Thank you for clarifying that.
> Write the logic in Perl first, then convert it to
> the server config.
>
That is where it is getting though for me because I am new to Perl and SQL. Maybe some with more brains could provide some insight how to solve it. Here is my SQL select statement:
SELECT (SUM(AcctInputOctets + AcctOutputOctets)) FROM radacct WHERE UserName='test' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b';
+-------------------------------------------+
| (SUM(AcctInputOctets + AcctOutputOctets)) |
+-------------------------------------------+
| 12965354 |
+-------------------------------------------+
What I would like to do is compare the returned value with another one which represents my traffic quota in bytes:
SELECT Value from radcheck WHERE UserName = 'test' AND Attribute = 'Max-Octets';
+-----------+
| Value |
+-----------+
| 200000000 |
+-----------+
If the value of Max-Octets is exceeded, login shall be denied.
Cheers,
Alexander
More information about the Freeradius-Users
mailing list