rlm_sqlcounter reset value

Anirudh Malhotra amalhotra.sp-dl at nkn.in
Sun Dec 13 06:34:58 CET 2015


Finally, i understand your question now. Or maybe i think i do.

Ok so in the authorize section use unlang as johan said use an attribute in radcheck which has value as "reset" or "never" whichever you want.

If("mysql query get attribute for user" == daily)
{
Dailyresetcounter
}
If("mysql query get attribute for user" == never)
{
Neverresetcounter
}

Hope this finally answers your question.

BR,
Anirudh Malhotra
NKN

Sent from a handheld device, Sorry for typos.

> On 13-Dec-2015, at 10:48, Muhammad Usman <muhd.usman87 at gmail.com> wrote:
> 
> I have already changed the query according to this wiki page, but now i
> want to keep the reset paramter as dynamic based on group.
> 
> sqlcounter dailycounter {
>   counter-name = 'Daily-Session-Time'
>   check-name = 'Max-Daily-Session'
>   sql_module_instance = 'sql'
>   key = 'User-Name'
>   reset = daily (rather defining it one time, I want it to dynamic,
> may be an SQL query)
>   query = "SELECT SUM(AcctSessionTime - GREATEST((%b -
> UNIX_TIMESTAMP(AcctStartTime)), 0)) FROM radacct WHERE
> UserName='%{${key}}' AND UNIX_TIMESTAMP(AcctStartTime) +
> AcctSessionTime > '%b'"
> }
> 
> 
> On Sun, Dec 13, 2015 at 10:01 AM, Anirudh Malhotra <amalhotra.sp-dl at nkn.in>
> wrote:
> 
>> Did you try changing the query in dailycounter?
>> http://wiki.freeradius.org/modules/Rlm_sqlcounter
>> 
>> Follow the link use another sql query instead of %b, to select the time
>> you want to select for the user.
>> BR,
>> Anirudh Malhotra
>> NKN
>> 
>> Sent from a handheld device, Sorry for typos.
>> 
>>> On 13-Dec-2015, at 10:18, Muhammad Usman <muhd.usman87 at gmail.com> wrote:
>>> 
>>> Thanks for your replies. Can you please elaborate your answers.
>>> 
>>> I want FreeRadius to get this value from database (stored different
>> values
>>> for different users) at runtime.
>>> How can i achieve different reset values for different users?
>>> 
>>> On Sun, Dec 13, 2015 at 7:31 AM, johan firdianto <johanfirdi at gmail.com>
>>> wrote:
>>> 
>>>> Use unlang
>>>> Pada tanggal 13 Des 2015 01.21, "Muhammad Usman" <
>> muhd.usman87 at gmail.com>
>>>> menulis:
>>>> 
>>>>> Hi,
>>>>> I have configured successfully the rlm_sqlcounter module and set the
>>>>> "reset" attribute to daily and its working properly, but I was
>> wondering
>>>> if
>>>>> it is possible to have this attribute dynamic for each user, based on
>> SQL
>>>>> query, meaning rather than defining a static value in configuration
>> file,
>>>>> is it possible to define a SQL query that runs each time and gets the
>>>> value
>>>>> from database. Thanks
>>>>> -
>>>>> List info/subscribe/unsubscribe? See
>>>>> http://www.freeradius.org/list/users.html
>>>> -
>>>> List info/subscribe/unsubscribe? See
>>>> http://www.freeradius.org/list/users.html
>>> -
>>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
>> -
>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list