NAME
VUser::Radius::Acct::SQL - SQL support for the VUser::Radius::Acct vuser extension
DESCRIPTION
Adds support for reading RADIUS accounting information from a SQL database.
CONFIGURATION
[vuser]
extensions = Radius::Acct::SQL
[Extension Radius::Acct::SQL]
# Database driver to use.
# The DBD::<driver> must exist or vuser will not be able to connect
# to your database.
# See perldoc DBD::<driver> for the format of this string for your database.
dsn = DBI:mysql:database=Accounts;host=lachesis;post=3306
# Database user name
username = user
# Database password
# The password may not end with whitespace.
password = pass
## SQL Queries
# Here you define the queries used to add, modify and delete users and
# attributes. There are a few predefined macros that you can use in your
# SQL. The values will be quoted and escaped before being inserted into
# the SQL.
# %u => username
# %r => realm
# %start => start time
# %end => end time
# %$phones => called station IDs, comma separated and quoted
# %-option => This will be replaced by the value of --option passed in
# when vuser is run.
# Here, we need a way to map columns to values
# Fixed columns:
# 1 total session time
# 2 total input octets
# 3 total output octets
acct_total_phone_query = SELECT sum(acct_session_time),sum(acct_input_octets),sum(acct_output_octets) from Radius_sessions where status != 4 and username = %u and event_date_time >= %start and event_date_time <= %end and called_station_id IN (%$phones)
acct_total_query = SELECT sum(acct_session_time),sum(acct_input_octets),sum(acct_output_octets) from Radius_sessions where status != 4 and username = %u and event_date_time >= %start and event_date_time <= %end
# Here, we need a way to map columns to values
# Fixed columns:
# 1 username
# 2 realm
# 3 session id
# 4 event timestamp
# 5 NAS IP address
# 6 session time
# 7 input octets
# 8 output octets
# 9 framed IP address
# 10 called station ID
# 11 calling station ID
acct_records_query = SELECT username, '', acct_session_id, event_date_time, nas_ip_address, acct_session_time, acct_input_octets, acct_output_octets, framed_ip_address, called_station_id, calling_station_id from Radius_sessions where status != 4 and username = %u and event_date_time >= %start and event_date_time <= %end
acct_records_phone_query = SELECT username, '', acct_session_id, event_date_time, nas_ip_address, acct_session_time, acct_input_octets, acct_output_octets, framed_ip_address, called_station_id, calling_station_id from Radius_sessions where status != 4 and username = %u and event_date_time >= %start and event_date_time <= %end and called_station_id IN (%\phones)
AUTHOR
Randy Smith <perlstalker@vuser.org>
LICENSE
This file is part of VUser-Radius-Acct-SQL.
VUser-Radius-Acct-SQL is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
VUser-Radius-Acct-SQL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VUser-Radius-Acct-SQL; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA