Calculating data usage between interim and stop packets.
Anuruddha Premalal
anuruddhapremalal at gmail.com
Mon Dec 5 23:27:05 CET 2016
Hi Alan,
Thanks for the response. I found the issue, it was with a cron job created
to delete orphan sessions and it has been configured to run every 10
minutes.
Thanks,
Anuruddha
On Sat, Dec 3, 2016 at 11:33 PM, Alan DeKok <aland at deployingradius.com>
wrote:
> On Dec 2, 2016, at 10:47 PM, Anuruddha Premalal <
> anuruddhapremalal at gmail.com> wrote:
> >
> > I'm trying to get users actual usage between accounting updates.
>
> Look at the difference between what's in the packet, and what's in SQL.
> Thats it.
>
> Except that the NAS may lie to you occasionally... because NASes are
> dumb.
>
> > With the
> > folowing method,
> >
> > 1. Extended the python *preacct* method and filterout only interim
> updates
> > and accounting stop packets.
>
> OK... that can be done in "unlang", too.
>
> > 2. Get the current usage recorded(inputoctets, outputoctets) from the
> mysql
> > databse for the accounting sessionid group by date and take the latest
> > value.
>
> OK...
>
> > 3. Take the difference between received input and output octets and the
> > valus in the database
> >
> > *tx*= new_input_octets - old_input_octets
> > *rx*= new_output_octets - old_output_octets
>
> That should be simple enough.
>
> > 3. Send a paylod to a message queue pnly if *tx, rx* values are positive.
>
> I don't know what that means, but OK...
>
> > I am trying to use this method to avoid periodic database polling to
> > perform this operation.
>
> Except that NASes don't need to send interim update packets. They may
> send them... or not. The updates may be regularly spaced... or not.
>
> > The issue is - at point 2 sometimes(intermittently) it returns an empty
> > record set even the session has already been started (already received an
> > accounting start).
>
> Then one of the following two situations is happening:
>
> a) the data isn't in the database
>
> b) the data is in the database, but isn't being returned.
>
> > Is freeradius clearing the existing accouting record from the database as
> > soon as it receives an accounting interim packet
>
> No.
>
> There is no magic here. All of the things that the server does is
> visible in the configuration files, and in the debug output.
>
> As always, if you want to see why something is happening, read the debug
> output.
>
> Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/
> list/users.html
--
*Anuruddha Premalala (MIEEE)Mobile : +94717213122E-mail :
anuruddhapremalal at gmail.com <anuruddhapremalal at gmail.com>web :
www.anuruddha.org <http://www.anuruddha.org>*
More information about the Freeradius-Users
mailing list