Re: How to generate 95th values? Was: How are the 95th values generated for Cacti? Are they wrong?

James Bensley <[email protected]>
Newsgroups gmane.network.cacti.user
Message-ID <CAAWx_pUPH2L-EWPSjXMerjapMcGFSrDYfVmQ7Mnp9k5foupRgg@mail.gmail.com>
To revisit this previous thread;

Is there anyway to calculate the same 95th value Cacti produces, but
from the CLI with rrdtool? I have put my results below, but I am
unable to generate the same value Cacti does when using
|95:bits:6:max:2|.

Many thanks,
James.

I use the following small script;
#!/bin/bash

echo -n "Average, in & out * 8, tottraf=in+out, 95th tottraf"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:AVERAGE \
DEF:out="$3":traffic_out:AVERAGE \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:tottraf=inbits,outbits,+ \
VDEF:95th=tottraf,95,PERCENT \
PRINT:95th:"95th='%.2lf %Sbps'"

echo -e -n "\nAverage, bytes to bits, tot=in,out,MAX"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:AVERAGE \
DEF:out="$3":traffic_out:AVERAGE \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:totbits=inbits,outbits,MAX \
VDEF:95th=totbits,95,PERCENT \
PRINT:95th:"95th='%.2lf %Sbps'"

echo -e -n "\nAverage, TOTAL, to bits"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:AVERAGE \
DEF:out="$3":traffic_out:AVERAGE \
CDEF:totbits=in,out,MAX,8,* \
VDEF:95th=totbits,95,PERCENT \
PRINT:95th:"95th='%.2lf %Sbps'"

echo -e -n "\nMax, TOTAL, to bits"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:MAX \
DEF:out="$3":traffic_out:MAX \
CDEF:totbits=in,out,MAX,8,* \
VDEF:95th=totbits,95,PERCENT \
PRINT:95th:"95th='%.2lf %Sbps'"



Script output;
james@s1:~$ sudo ./rrd95thsingle 1358502298 1358761498
/var/lib/cacti/rra/castle-cpe_traffic_in_11664.rrd
Average, in & out * 8, tottraf=in+out, 95th tottraf
95th='1.70 Mbps'

Average, bytes to bits, tot=in,out,MAX
95th='1.60 Mbps'

Average, TOTAL, to bits
95th='1.60 Mbps'

Max, TOTAL, to bits
95th='2.06 Mbps'



Debug from Cacti graph of same rrd file, which gives 95th as 1.53Mbit;

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1358502298 \
--end=1358761498 \
--title='castle-cpe -  Fa0/0 - |query_ifDesc|' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
COMMENT:"From 2013/01/18 09\:44\:58 To 2013/01/21 09\:44\:58\c" \
COMMENT:"  \n" \
--vertical-label='bits per second' \
--slope-mode \
--font TITLE:10: \
--font AXIS:8: \
--font LEGEND:7: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/castle-cpe_traffic_in_11664.rrd":traffic_in:AVERAGE \
DEF:b="/var/lib/cacti/rra/castle-cpe_traffic_in_11664.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
AREA:cdefa#00CF00FF:"Inbound"  \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefe#002A97FF:"Outbound"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"  \
COMMENT:" \n" \
HRULE:1534773.74#FF0000FF:"95th Percentile"  \
COMMENT:"(1.53 mbit in+out)"

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.