[flow-tools] 95th percentile billing information

Horatio B. Bogbindero wyy@admu.edu.ph
Wed, 5 Jun 2002 10:06:04 +0800


here is a crude script that hopefully does more or less what you want.
feel free to email me if you need something else. 

#!/bin/bash
# a very crude script that computes the 95th percentile and returns 
# the results by IP arranged by usage in octets
#
# William Emmanuel S. YU <wyu@ateneo.edu>
# Ateneo de Manila University, Philippines
#

# directories and files
NETFLOWDIR=/home/netflow
BINDIR=$NETFLOWDIR/bin

DATADIR=/data/
TMPDIR=/tmp

# execute split for break file into smaller chunks
$BINDIR/flow-cat -a $DATADIR | flow-split-orig -T300 -o $TMPDIR/slice

# count the upper five percent
COUNT=`ls -l $TMPDIR/slice* | wc -l`
LIMIT=`echo "($COUNT * 5) / 100" | bc`

# remove upper fix percent
for ((a=1; a <= LIMIT ; a++))  
do
  rm `ls -S1 $TMPDIR/slice* | head -1`
done    

# process summary. change this part to generate the report you want.
$BINDIR/flow-cat -a $TMPDIR/slice* | flow-stat -n -f8 -S2

# clean-up slices when done
rm $TMPDIR/slice*


Surlignage "Horatio B. Bogbindero" <wyu@ateneo.edu>:

> Surlignage William Groh <william@miamiconsultant.net>:
> 
> > By 95th percentile billing, at the lowest levels, I mean taking the
> amount
> > of time you are billing for (a month usually) and dividing it into time 
> > slices (usually 5 minutes) then taking 5% of those timeslices with the 
> highest
> > bandwidth usage and discarding them, the highest remaining peak traffic
> > level is the bandwidth rate used to bill.
> > 
> what is the rationale for discarding the highest 5% of the timeslices? why
> use 5 min timeslices?
> 
> > There are a couple of derivatives, but this is a good idea of the
> concept.
> >
> interesting. of course, there is nothing instantly available right now. 
our
> 
> billing system here using the whole amount with no discards. 
> 
> right now i have no solution at hand. but, i will think about it and 
maybe 
> i can get something up. 
> 
> thanks.
> 
> > 
> > "Horatio B. Bogbindero" wrote:
> > 
> > > Surlignage William Groh <william@miamiconsultant.net>:
> > >
> > > > I see that you can generate GB per month information as well as 
> average
> > > > Mbps from flow-stat, does anybody know of a way of generating 95th
> > > > percentile billing information using flow-tools.
> > > >
> > > > I have worked with tools like http://freshmeat.net/projects/flavio/ 
> but
> > > > there are some limitations.
> > > >
> > > i am not familiar with that term 95th billing percentile. maybe if you
> > > explain it there maybe a solution. or i could possibly have one
> already.
> > >
> > > good luck!
> > >
> 



-------------------------------------------
William Emmanuel S. Yu
Ateneo Campus Network Group (AteneoCNG)
email  :  wyu at ateneo dot edu
web    :  http://CNG.ateneo.net/wyu/
phone  :  +63(2)4266001-4186
GPG    :  http://CNG.ateneo.net/wyu/wyy.pgp