Re: Radius programs...

Phil Jensen - News Administrator (phil@sierra.valleynet.com)
Wed, 1 Nov 1995 10:33:08 -0800 (PST)

On Wed, 1 Nov 1995 dmcpike@henge.com asked politely:

> Hello, have any of you out there tried making a program that works with
> radius and the mSQL server that would basically summarize a report of users
> on our system, that have used over the limit of hours we impose per month???
> Or do you know where I could look?

Good morning. :)

Here's something you can use... (keep in mind I am writing this on the fly)
The below script doesn't use mSQL, but there are some ideas for using mSQL
below.

#!/bin/sh
#
# 10-hour accounting monitor
# By Phil Jensen
# News Administrator
# ValleyNet Communications
#
# Place me in your crontab somewhere.
# You also need Carl Rigney's raquick tool.
#
# This program will take a list of names from $file, parse them using
# raquick on the accounting file $account, and mail them to $mail.
# It will spit out a list of names of people over $hours hours.
# One last thing, put your path to raquick in $pathtoraquick.

file="/var/staff/home/phil/10-hour_people"
account="/usr/adm/radacct/fresno1.valleynet.com/detail"
mail="phil@valleynet.com"
hours="10"
pathtoraquick="/var/staff/tools/raquick"
pathtosendmail="/usr/sbin/sendmail"

$raquick $account > /tmp/phil$$

set `cat $file`
for u
do
awk ' $2 ~ "^"hours":" && $1 = name { print $0 } ' hours=$hours name=$1 /tmp/phil$$ >> /tmp/phil2$$
shift
done
$pathtosendmail $mail

# End program.

Okay... if you want an mSQL interface... use msqladmin to create a new
database, and add a table with a name and a time field... have raquick
pipe each users name and time through a script like this:

echo "insert into table RADIUS-mSQL values ('$1', '$2')\g" | msql RADIUS-database
Then just parse the output however you'd like... I can think of about
ten different ways offhand, but if you need any more help, you can call
me at the below number or drop me some email.

> Thanks much.

It was my pleasure. :)

Phil Jensen _\\|//_
News Administrator (-0-0-)
---------------------------------------------------------------ooO-(_)-Ooo----
ValleyNet Communications - Central California's Premier Internet Provider
------------------------------------------------------------------------------
Voice: (209) 486-VNET (8638) 2300 Tulare, Suite 100
Fax: (209) 495-4940 Fresno, CA 93721-2226
Data: (209) 495-4950 http://www.valleynet.com
==============================================================================