sqlcounter instance not found in modules section
Hey Everyone, I'm trying to create a new sqlcounter instance that counts octets. I think what I've done is correct but I get the following error when I start FreeRadius... -------- Mon Oct 1 21:09:41 2012 : Error: /usr/local/etc/raddb/sites-enabled/default[203]: Failed to find "dailyoctetcounter" in the "modules" section. Mon Oct 1 21:09:41 2012 : Error: /usr/local/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section. Mon Oct 1 21:09:41 2012 : Error: Failed to load virtual server <default> -------- This error also occurs when I change the name of "dailycounter" to be "dailytimecounter". My relivant config is as follows... ---- radius.conf ---- instantiate { dailycounter dailyoctetcounter } --------- ---- sql/mysql/counter.conf ---- sqlcounter dailyoctetcounter { counter-name = Daily-Session-Octet check-name = Max-Daily-Session-Octet reply-name = ChilliSpot-Max-Total-Octets sqlmod-inst = sql key = User-Name reset = daily query = "SELECT SUM(acctinputoctets + acctoutputoctets) \ FROM radacct WHERE username = '%{%k}' \ AND UNIX_TIMESTAMP(acctstarttime) > '%b'" } sqlcounter dailycounter { counter-name = Daily-Session-Time check-name = Max-Daily-Session reply-name = Session-Timeout sqlmod-inst = sql key = User-Name reset = daily query = "SELECT SUM(acctsessiontime - \ GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \ FROM radacct WHERE username = '%{%k}' AND \ UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b'" } -------- ---- sites-enabled/default ---- authorize { dailycounter { reject = 1 } if (reject) { update reply { Reply-Message := "Your daily time limit is up!" } ok = reject } dailyoctetcounter { reject = 1 } if (reject) { update reply { Reply-Message := "Your daily transfer limit is up!" } ok = reject } } -------- Is there a set of keywords that are only valid for sqlcounters? Or like I think anything that isn't already another instance should be vaild. Please tell me where I'm going wrong with my config. Thanks Russ
Russell Stockhammer wrote:
I'm trying to create a new sqlcounter instance that counts octets. I think what I've done is correct but I get the following error when I start FreeRadius...
...
---- sql/mysql/counter.conf ----
Why? The default sqlcounter file is in raddb/modules. Put the "dailyoctetcounter" configuration there, and it will work. Alan DeKok.
On Tue, Oct 2, 2012 at 6:47 PM, Alan DeKok <aland@deployingradius.com> wrote:
Russell Stockhammer wrote:
I'm trying to create a new sqlcounter instance that counts octets. I think what I've done is correct but I get the following error when I start FreeRadius...
...
---- sql/mysql/counter.conf ----
Why? The default sqlcounter file is in raddb/modules. Put the "dailyoctetcounter" configuration there, and it will work.
I think he might got confused because there are raddb/sql/mysql/counter.conf and raddb/sql/postgresql/counter.conf, as well as raddb/modules/sqlcounter_expire_on_login. Perhaps we should add a small instruction on top of raddb/sql/*/counter.conf, saying something like "copy this file to raddb/modules and adjust as needed"? Plus probably a small update to doc/rlm_sqlcounter. If no one else does this first I'll probably be able to send a pull request in the next day or two. -- Fajar
Fajar A. Nugraha wrote:
I think he might got confused because there are raddb/sql/mysql/counter.conf and raddb/sql/postgresql/counter.conf, as well as raddb/modules/sqlcounter_expire_on_login.
OK... and the modules are in the raddb/modules directory.
Perhaps we should add a small instruction on top of raddb/sql/*/counter.conf, saying something like "copy this file to raddb/modules and adjust as needed"? Plus probably a small update to doc/rlm_sqlcounter. If no one else does this first I'll probably be able to send a pull request in the next day or two.
Sure. Alan DeKok.
On Tue, 2 Oct 2012, Fajar A. Nugraha wrote:
On Tue, Oct 2, 2012 at 6:47 PM, Alan DeKok <aland@deployingradius.com> wrote:
Russell Stockhammer wrote:
I'm trying to create a new sqlcounter instance that counts octets. I think what I've done is correct but I get the following error when I start FreeRadius...
...
---- sql/mysql/counter.conf ----
Why? The default sqlcounter file is in raddb/modules. Put the "dailyoctetcounter" configuration there, and it will work.
I think he might got confused because there are raddb/sql/mysql/counter.conf and raddb/sql/postgresql/counter.conf, as well as raddb/modules/sqlcounter_expire_on_login.
Perhaps we should add a small instruction on top of raddb/sql/*/counter.conf, saying something like "copy this file to raddb/modules and adjust as needed"? Plus probably a small update to doc/rlm_sqlcounter. If no one else does this first I'll probably be able to send a pull request in the next day or two.
Ok, but there is also a; --------- $INCLUDE sql/mysql/counter.conf -------- but default in the modules section of radius.conf. So I assumed it didn't need to be copied anywhere.
-- Fajar - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Wed, Oct 3, 2012 at 12:04 PM, Russell Stockhammer <russgrue@329ncle.no-ip.org> wrote:
Ok, but there is also a;
---------
$INCLUDE sql/mysql/counter.conf
--------
Good catch :) FR is pretty flexible in its configuration. Suffice to say that most (all?) module configuration (including sql and eap) in 3.x is moved to modules-available, but in 2.x you might find them anywhere inside raddb. You can either uncomment that line, or copy it to modules directory, which should do the same thing.
but default in the modules section of radius.conf. So I assumed it didn't need to be copied anywhere.
At times like this it's handy if you pasted the WHOLE output of radiusd -X. Among others, it will show whether it reads the correct file. Usually you edit one file while FR loads the other. -- Fajar
On Wed, 3 Oct 2012, Fajar A. Nugraha wrote:
At times like this it's handy if you pasted the WHOLE output of radiusd -X. Among others, it will show whether it reads the correct file. Usually you edit one file while FR loads the other.
Interestingly enough when I run radiusd -X it loads perfectly then any time I run radiusd normally it works as well... But if I change the name of a sqlcounter instance and run radiusd normally it will error until radiusd -X is run again.... Very strange!!! I spend all last night testing this and it seams I was always doign the right thing config wise it was just radiusd didn't read all the config files until it was run with the debug -X argument once. If anyone can replicate this it might be a bug or it could just be a bug in my compile. Thanks everyone! Russ
On Tue, 2 Oct 2012, Alan DeKok wrote:
Russell Stockhammer wrote:
I'm trying to create a new sqlcounter instance that counts octets. I think what I've done is correct but I get the following error when I start FreeRadius...
...
---- sql/mysql/counter.conf ----
Why? The default sqlcounter file is in raddb/modules. Put the "dailyoctetcounter" configuration there, and it will work.
Thanks for the response. There wasn't a sqlcounter file in raddb/modules when I installed it. I copied the file into raddb/modules and still get the same error. Is there something else I need to do?
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (3)
-
Alan DeKok -
Fajar A. Nugraha -
Russell Stockhammer