No idea to be honest, im a novice. Many web-sites seem to advice using that and it works for the "most part"
OK. It's wrong. That part of the expression counts time not octets. It handles sessions that started in one counting period and continue into next one. Data is counted properly without such additions. Delete it.
query = "SELECT SUM(AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
Thank You, Will Try This!
Remove "+ AcctSessionTime" if you don't want sessions that started in one counting period and continuing into the next one to count in the new one.
One counting period meaning beginning of month? So it should be: query = "SELECT SUM(AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) > '%b'" If I want to allow users say 1Gb per month limit that gets reset every month. (In other words no cary over of data) And: query = "SELECT SUM(AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'" If I want them to be able to use there unused data from previous month + new data limit? Please excuse my lack of knowledge! Really appreciate the help though!
And tell Dirk and others where you found that information not to mix time and data counters.
Ivan Kalik Kalik Informatika ISP