Using accounting data for quotas

ahmed adel ahmedadel4eg at yahoo.com
Sun Feb 15 10:13:20 CET 2009


I have implemented quota service based on Freeradius before, and I
think that it is close to what you are looking for except that in my
case there was a required action. Anyway it is normal that session
remain open for long time so if using SQL you can have a trigger on the
accounting table to update another table with a summary of the total
bandwidth used for each user and this is available for MySQL and MSSQL.

As for simultaneous you can disable that using simultaneous-use option.

Also it is normal that the updates come in different times but the trigger on the database will solve this issue.

For the traffic counters there are two approaches one is that your
network equipment supports sending what is called Giga-Word counter
which is a counter that tells you how many times the counter has rolled
over, if not you will have to handle this in your SQL statment and this
is by keeping the last update in a field in the database and on the new
update compare the new update with the previous one and if the previous
one is bigger just by simple math compensate for the different.

For the last point also the trigger on the database will solve it as you will have another table to hold the history in.

Best Regards
Ahmed Adel



________________________________
From: Jonathan Gazeley <jonathan.gazeley at bristol.ac.uk>
To: freeradius-users at lists.freeradius.org
Sent: Friday, February 13, 2009 12:56:14 PM
Subject: Using accounting data for quotas

I'm trying to find a way to extract useful data from accounting logs to use towards a quota. I'm a bit stuck and I'm wondering if anyone has tried anything similar with success. Let me explain...

My accounting logs are sent to SQL with the inner ID. Periodically, the NAS updates the accounting record with total of upload and download during that session. I've tweaked the FR queries so they also update a new field called 'lastupdatetime'.

I want to write an hourly script that will tell me (eg in a CSV file) how much traffic has been done for each username (not necessarily each session) during the last hour. Clearly this will take some sort of hourly summary that can be compared each hour. But it is still not straightforward:

- Some sessions remain open for weeks.
- Some users have multiple simultaneous or multiple sequential sessions.
- The updates come in at different times.
- The traffic counters will roll over from time to time.
- It's not possible to query hourly on how traffic the user has used since forever, because records older than around 90 days are dropped.

Any ideas? Or am I barking up completely the wrong tree...

Cheers,
Jonathan

----------------------------
Jonathan Gazeley
Systems Support Specialist
ResNet | Wireless & VPN Team
Information Services
University of Bristol
----------------------------

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



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20090215/1677c95d/attachment.html>


More information about the Freeradius-Users mailing list