Calculating data usage between interim and stop packets.
Anuruddha Premalal
anuruddhapremalal at gmail.com
Sat Dec 3 04:47:06 CET 2016
Hi All,
I'm trying to get users actual usage between accounting updates. With the
folowing method,
1. Extended the python *preacct* method and filterout only interim updates
and accounting stop packets.
2. Get the current usage recorded(inputoctets, outputoctets) from the mysql
databse for the accounting sessionid group by date and take the latest
value.
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
3. Send a paylod to a message queue pnly if *tx, rx* values are positive.
I am trying to use this method to avoid periodic database polling to
perform this operation.
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).
Is freeradius clearing the existing accouting record from the database as
soon as it receives an accounting interim paccket - is there a way to
insert my logic before that happens?
Thanks & Best Regards,
--
*Anuruddha Premalala (MIEEE)Mobile : +94717213122 <071%20721%203122>E-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