[rrd-users] 95% Percentile number to Display as a Negative?

spite ryan.crouch at gmail.com
Wed Mar 17 07:28:54 CET 2010

I am using the following configuration for a RRD Graph Generation.

rrdtool graph /tmp/imgout/outgraph.png --start -86400 -e -300  \
  DEF:if_in_bytes=$RRDFILE:if_in:AVERAGE \
  DEF:if_out_bytes=$RRDFILE:if_out:AVERAGE \
  "CDEF:if_in_bits=if_in_bytes,8,*" \
  "CDEF:if_out_bits=if_out_bytes,8,*" \
  "CDEF:if_out_bits_neg=if_out_bits,-1,*" \
  "CDEF:if_bytes=if_bytes_in,if_bytes_out,+" \
  AREA:if_in_bits#00dd00:'Receive (RX)' \
  AREA:if_out_bits_neg#0000ff:'Transmit (TX)' \
  COMMENT:" \n" \
  COMMENT:"               Maximum       Average        Current" \
  COMMENT:" \n" \
  COMMENT:"In      " \
  GPRINT:if_in_bits:MAX:'%7.2lf %sb/s' \
  GPRINT:if_in_bits:AVERAGE:"%7.2lf %Sb/s" \
  GPRINT:if_in_bits:LAST:"%7.2lf %Sb/s" \
  COMMENT:" \n" \
  COMMENT:"Out     " \
  GPRINT:if_out_bits:MAX:"%7.2lf %Sb/s" \
  GPRINT:if_out_bits:AVERAGE:"%7.2lf %Sb/s" \
  GPRINT:if_out_bits:LAST:"%7.2lf %Sb/s" \
  COMMENT:" \n" \
  COMMENT:" \n" \
  GPRINT:if_bytes_in:AVERAGE:"Totals    %7.2lf %sB i" \
  GPRINT:if_bytes_out:AVERAGE:"%7.2lf %sB o" \
  GPRINT:if_bytes:AVERAGE:"%7.2lf %sB t" \
  COMMENT:" \n" \
  -v "bits/sec" -t "$2" -h 150 -w 392 -x "HOUR:1:HOUR:6:HOUR:2:0:%H"


I have figured out I need to add the following two lines to my RRDTool
  "VDEF:if_in_pc=if_in_bits,95,PERCENT" \
  "VDEF:if_out_pc=if_out_bits,95,PERCENT" \

My problem is, I graph my inbound network Data as a positive Y VALUE and
outbound Network Data as a Negative Y Value. All calculations for reporting
are done using the positive values, but the graph is rendered (AREA/LINE)
using the negatives for outbound.

While this works ok for the CDEF values (by creating $result x -1) I am
unable to do the same for the VDEF Value.

The above 95th Percentile lines calculate the positive 95th Percentile for
both (if_in and if_out) data sources in my RRD however I cannot convert the
VDEF result to a negative for use as a HRULE when rendering my graph. I also
cannot obviously calculate my 95th percentile figures using the negative

How do I flip the VDEF result to a negative for use in HRULE? or how do I
get around this all together? I wish I had listend in maths .... 

I hope what I posted makes sense :D, thanks in advance.
View this message in context: http://n2.nabble.com/95-Percentile-number-to-Display-as-a-Negative-tp4748615p4748615.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.

More information about the rrd-users mailing list