A few years back I wrote a collection script for Cricket that calculated the 95th percentile data rate on an interface. I called it cricket-95.pl. Since then a PERCENTILE function has been added in the core rrdtool code. This article is my investigation on whether this function meets my needs.
I started with a brief look at the code, and found that the PERCENTILE function is only available to the grapher as a VDEF, it can't be used as a CDEF for updates. Not a promising start: Plotting the 95th percentile on a graph is only one part of the requirements for usage based traffic monitoring. Not a show stopper though; just because the grapher is based on dynamic calcs doesn't preclude using a background script (such as cricket-95.pl) to make a seperate calculation of the 95th percentile at scheduled intervals.
So how do the graphs look? I ran a few graphs using rrdtool to compare the output.
Monthly Comparisons


While the final calculated 95th percentile is similar in both cases, the internal function gives no visibility on the evolution of the 95th percentile over time, which makes it pretty much useless for trend analysis.
Weekly Comparison


The weekly graph shows a larger discrepancy, due to the fact that cricket-95.pl always calculates on the monthly figures, whereas the internal function graphs based on the sample set to be presented (i.e. only on the week's values)
Conclusions
There's still life in cricket-95.pl. I have developed it beyond the script available on my site and it looks like it's still worth continuing that development. It's just a pain that I can't release any versions newer than the one already on my website due to contractual issues with my employer :(
Appendix: The command-line used
Below is the command-line used to generate the cricket-95 monthly graph
rrdtool graph cr95-month-2hr.png -s 1153436400 -e 1156114799 \
-S 1800 \
DEF:in=peer-linx-gw1.rrd:ds0:AVERAGE \
DEF:out=peer-linx-gw1.rrd:ds1:AVERAGE \
DEF:pc95=peer-linx-gw1.rrd:ds2:AVERAGE \
LINE1:in#00ff00:"Input\n" \
LINE1:out#0000ff:"Output\n" \
LINE1:pc95#ff0000:"95th Percentile\n" \
COMMENT:"Cricket 95, 2hr resolution, 1 month"
Below is the command-line used to generate the internal 95th percentile monthly graph
rrdtool graph cr95-month-2hr.png -s 1153436400 -e 1156114799 \
-S 1800 \
DEF:in=peer-linx-gw1.rrd:ds0:AVERAGE \
DEF:out=peer-linx-gw1.rrd:ds1:AVERAGE \
CEF:max=in,out,MAX \
VDEF:pc95=max,95,PERCENT \
LINE1:in#00ff00:"Input\n" \
LINE1:out#0000ff:"Output\n" \
LINE1:pc95#ff0000:"95th Percentile\n" \
COMMENT:"95,PERCENT 2hr resolution, 1 month"