Help with sqlcounter for data transferred

Fabrizio Fiore Donati fabrizio.fioredonati at
Wed Sep 25 18:57:51 CEST 2013

i'm configuring a server with a sql counter to check the total byte in a
week for the users.
But the server will reply a wrong count.

Here's the counter:

sqlcounter weeklybytecounter {
counter-name = Weekly-Total-Max-Octets
check-name = Max-Weekly-Octets
reply-name = Mikrotik-Total-Limit
sqlmod-inst = sql
key = User-Name
reset = weekly
query = "SELECT (SUM(acctinputoctets)+SUM(acctoutputoctets)) FROM radacct
WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime
> '%b'"

But the reply doesn't is the operation between (check-name value) - (query

for example:

rlm_sqlcounter: Authorized user fabrizio, check_item=3000000000,

I expect a reply of 3000000000 - 38101894 = 2961898106

but i receive different value also bigger.....

Any idea ?

Fabrizio Fiore Donati

Mobile: +39 3289872420
E-mail: fabrizio.fioredonati at

2bite s.r.l.
Via Saragat snc
67100 L'Aquila (AQ) - Italy
Tel.: +39 0862441583
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Freeradius-Users mailing list