Date created: Monday, January 21, 2013 5:59:49 PM. Last modified: Sunday, May 5, 2013 4:23:17 PM
RRDTool Join 95th Tests
These are ideas for getting a single 95th value out of RRDtool, however none of them match the value in Cacti which has been verified as correct (Cacti gives 1.53Mbits) (Working script is now here);
#!/bin/bash echo -n "1: Average values, in & out * 8, tot=in+out, 95th tot" 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 "\n2: Average values, in & out * 8, tot=in,out,MAX, 95th tot" 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 "\n3: Average values, TOTAL in & out and to bits, then 95th" 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 "\n4: Max values, 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'" echo -e -n "\n5: Average values, replace unavailable values with PREVious" 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:safein=inbits,UN,PREV,inbits,IF \ CDEF:safeout=outbits,UN,PREV,outbits,IF \ VDEF:finalin=safein,95,PERCENT \ VDEF:finalout=safeout,95,PERCENT \ PRINT:finalin:"%.2lf %Sb" \ PRINT:finalout:"%.2lf %Sb"
The output looks like this:
james@server:~$ sudo ./rrd95thsingle 1358502298 1358761498 /var/lib/cacti/rra/castle-cpe_traffic_in_11664.rrd 1: Average values, in & out * 8, tot=in+out, 95th tot 95th='1.70 Mbps' 2: Average values, in & out * 8, tot=in,out,MAX, 95th tot 95th='1.60 Mbps' 3: Average values, TOTAL in & out and to bits, then 95th 95th='1.60 Mbps' 4: Max values, TOTAL, to bits 95th='2.06 Mbps' 5: Average values, replace unavailable values with PREVious 131.49 kb 1604.13 kb
This was the Cacti graph debug output
/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)"
Previous page: RRDTool 95th for Joint In & Out
Next page: RRDTool 95th for Separate In & Out