Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (ASCEND) Users On-Line Time via HTML
On Tue, Aug 05, 1997 at 01:34:30PM -0400, Talbert K. Coker wrote:
> I am looking for a script that would allow my users
> to see how much time they have used during the
> month. They would need to access it from a web page
> using their username and password capture the
> information from the radius detail file and display
> it on a second html page.
>
> I am not looking for a complete accounting package
> but just a service for my subscribers.
>
> Can anyone help or point me in the right direction.
I'm using a minimalistic shell script as CGI-BIN for that problem.
The reason for it to be minimalistic is that I have patched my radius
daemon to not log the pletora of stuff it is usually logging in this
"dedicated format for beeing hard to parse", but instead it logs:
<tstamp> Start <username>
<tstamp> Stop <username> <seconds> <bytes-in> <bytes-out>
For obvious reasons, I renamed the log file from "detail" to "summary" ;)
With the above, the collection is a matter of some lines of GNU awk alike:
$2 == "Stop" {
if($3 != "") {
month = strftime("%y%m ", $1);
secs[month,$3] += $4;
bytes[month,$3] += $5;
bytes[month,$3] += $6;
}
}
END {
for(profile in secs) {
unit = "bytes";
ub = bytes[profile];
if(ub > 1024) {
ub /= 1024;
unit = "Kbytes";
if(ub > 1024) {
ub /= 1024;
unit = "Mbytes";
}
}
printf "%-24s: %12g s %12g %s\n", profile, secs[profile], ub, unit;
}
}
The hard part is not the collection, but the patch to the deamon. I would
provide a diff to patch(1) it, but the relevant code has moved from file
to file and my patch won't work with your sources (likely).
--
Kanther-Line: PGP SSH IDEA MD5 GOST RIPE-MD160 3DES RSA FEAL32 RC4
+-o-+--------------------------------------------------------+-o-+
| o | \\\- Brain Inside -/// | o |
| o | ^^^^^^^^^^^^^^ | o |
| o | Andre' Beck (ABPSoft) beck@ibh-dd.de XLink PoP Dresden | o |
+-o-+--------------------------------------------------------+-o-+
++ Ascend Users Mailing List ++
To unsubscribe: send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd: <http://www.nealis.net/ascend/faq>
References: