radius script

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
omar_armas

radius script

Post by omar_armas »

I made this script to gather information from a Free Radius server using the mysql module:

Code: Select all

#!/usr/bin/perl
#
#
#This script fetch the number of online users in a Freeradius server with mysql module.
#You just have to change login, password, databasename and the ip address of your NAS.
#Omar Armas <oarmas at mpsnet.net.mx>

use DBI;

my $dsn = 'DBI:mysql:radius:localhost';
my $db_user_name = 'username';
my $db_password = 'password';
my $dbh = DBI->connect($dsn, $db_user_name, $db_password) or die "Failed to connect $DBI::errstr\n";

my $sth = $dbh->prepare(qq{
    SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId FROM radacct
        WHERE AcctStopTime = '0' AND NASIPAddress = '200.23.1.1' GROUP BY UserName
    });
$sth->execute();
print $sth->rows();

exit;

Omar
kiko84
Posts: 15
Joined: Mon May 17, 2004 4:06 am

Post by kiko84 »

Hi,

I need to generate statistic graphs for a Radius server.
I would like use your script. Is it possible to obtain your Template - Graph, Data.. and if it's necessary your "Data Input Method"

I would be very urgent

Thank you very much
Regards.
myhotzone
Posts: 1
Joined: Fri Apr 07, 2006 5:46 am
Contact:

Hi Omar

Post by myhotzone »

Can you tell me how to activate this script to monitor the number of online users in Free Radius? Do you have a quick how to page?

Cheers,

Niall
troffasky
Posts: 5
Joined: Sun Mar 12, 2006 11:37 am
Location: Little Snoreing
Contact:

Re: Hi Omar

Post by troffasky »

I used a quick and dirty method to achieve the above. I put a similar perl CGI script on the FreeRADIUS server, and then [following the script-to-graph howto in the Cacti docs] wrote a script to pull down the number of logged in users and graph it. I did it this way because Cacti is running on a host outside the data centre where FreeRADIUS is running. It works well, however now I want to graph the radacct tables, to graph how much data each customer is using...
radiaz22
Posts: 4
Joined: Sat Apr 04, 2020 11:23 am

Re: radius script

Post by radiaz22 »

troffasky wrote: Sun Apr 09, 2006 1:03 pm I used a quick and dirty method to achieve the above. I put a similar perl CGI script on the FreeRADIUS server, and then [following the script-to-graph howto in the Cacti docs] wrote a script to pull down the number of logged in users and graph it. I did it this way because Cacti is running on a host outside the data centre where FreeRADIUS is running. It works well, however now I want to graph the radacct tables, to graph how much data each customer is using...
Hello, I know this post is very old, but I'm looking for something very similar, to graph radacct tables in order to know how much data each customer is using. I have a VM with freeradius, cacti and chillispot.
Please help me. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest