On Tue, Feb 13, 2007 at 03:58:31AM -0800, Sekhar wrote: > I am looking for 95th percentile bandwidth monitoring billing software for isp's.I know one is RTG but this doesn't provide export billing details. i am also looking for commercial and opensource software. A script against the RRD files MRTG or cricket produces would be sufficient, with a little tuning of the RRD files to keep sufficient history... Something like this: #! /bin/sh MONTH=$1 [ "x$MONTH" = 'x' ] && MONTH=`date +%-m` YEAR=`date +%-Y` if [[ $MONTH -gt `date +%-m` ]]; then YEAR=`echo "$YEAR - 1" | bc`; fi LASTDAY=`cal $MONTH $YEAR | grep -v "^$" | tail -1 | awk '{print $NF}'` #MONTHNAME=`cal $MONTH $YEAR | head -n 1 | awk '{print $1}'` #echo $MONTH # OK, we need to fetch the start dates from MONTH... rrdtool fetch interface.rrd AVERAGE --start "00:00 $MONTH/01/$YEAR" --end "23:55 $MONTH/$LASTDAY/$YEAR" |grep -v nan |perl -e 'my $last = 0; my $month = '$MONTH'; my @days = (0,31,28,31,30,31,30,31,31,30,31,30,31); while (<>) {next unless /^(\d{10}):\s+([\d\.\+e]+)\s+([\d\.\+e]+)\s+([\d\.\+e]+)\s+([\d\.\+e]+)\s+([\d\.\+e]+)\s+([\d\.\+e]+)/;if ($last != 0 and $1 != $last + 300) { print STDERR "Bad jump: $last -> $1\n" }; push (@sample, (($2>$3?$2:$3) * 8 / 1000 / 1000));$last = $1;}; @sorted = sort {$b <=> $a} @sample; print "95th so far: ",@sorted[int(@sorted/20)-1], "\n", "95th of month so far: ",@sorted[$days[$month]*24*12/20],"\n";' (Yes, the last line begins 'rrdtool fetch'...) -- ----------------------------------------------------------- Paul "TBBle" Hampson, B.Sc, LPI, MCSE On-hiatus Asian Studies student, ANU The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361) Paul.Hampson@Pobox.Com Of course Pacman didn't influence us as kids. If it did, we'd be running around in darkened rooms, popping pills and listening to repetitive music. -- Kristian Wilson, Nintendo, Inc, 1989 License: http://creativecommons.org/licenses/by/2.1/au/ -----------------------------------------------------------
Attachment:
pgpbUwzorV9xe.pgp
Description: PGP signature