Get port traffic from rrdtool

I want to do some reporting on a few of our lines regarding capacity, for which I want to get port data (out of the rrd files). Namely, the 95 percentile for a given day between 07:00 and 18:00.

In the port details this is shown. Below is a picture of the smallest interval on a port:

I haven’t worked with RRDtool before, but when I try to get the inoctets, the values seem a bit off:

# rrdtool xport --start 1535004000 --end 1535004300  DEF:inoctets=/opt/librenms/rrd/10.226.81.254/port-id5720.rrd:INOCTETS:AVERAGE XPORT:inoctets
<?xml version="1.0" encoding="ISO-8859-1"?>

<xport>
  <meta>
    <start>1535004000</start>
    <end>1535004300</end>
    <step>300</step>
    <rows>1</rows>
    <columns>1</columns>
    <legend>
      <entry></entry>
    </legend>
  </meta>
  <data>
    <row><v>1.7176927753e+06</v></row>
  </data>
</xport>

How would I go from this to the 718 MB total in traffic listed in the graph? Or even better, to the 95’th percentile for a given interval in mbps?

Solving my own question, after finding https://lists.oetiker.ch/pipermail/rrd-users/2006-August/011544.html, just replacing GPRINT with PRINT in the command:

rrdtool graph /tmp/T2Cc1qFrgIuWLGH5  --alt-autoscale-max --rigid -E --start 1535004000 --end 1535004300 --width 1359 --height 535 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal DEF:outoctets=/opt/librenms/rrd/10.226.81.254/port-id5720.rrd:OUTOCTETS:AVERAGE DEF:inoctets=/opt/librenms/rrd/10.226.81.254/port-id5720.rrd:INOCTETS:AVERAGE DEF:outoctets_max=/opt/librenms/rrd/10.226.81.254/port-id5720.rrd:OUTOCTETS:MAX DEF:inoctets_max=/opt/librenms/rrd/10.226.81.254/port-id5720.rrd:INOCTETS:MAX CDEF:octets=inoctets,outoctets,+ CDEF:doutoctets=outoctets,-1,* CDEF:outbits=outoctets,8,* CDEF:outbits_max=outoctets_max,8,* CDEF:doutoctets_max=outoctets_max,-1,* CDEF:doutbits=doutoctets,8,* CDEF:doutbits_max=doutoctets_max,8,* CDEF:inbits=inoctets,8,* CDEF:inbits_max=inoctets_max,8,* VDEF:totin=inoctets,TOTAL VDEF:totout=outoctets,TOTAL VDEF:tot=octets,TOTAL CDEF:dpercentile_outn=doutbits,-1,* VDEF:dpercentile_outnp=dpercentile_outn,95,PERCENT CDEF:dpercentile_outnpn=doutbits,doutbits,-,dpercentile_outnp,-1,*,+ VDEF:dpercentile_out=dpercentile_outnpn,FIRST VDEF:percentile_in=inbits,95,PERCENT VDEF:percentile_out=outbits,95,PERCENT COMMENT:'bps      Now       Ave      Max      95th %\n' AREA:inbits_max#D7FFC7: AREA:inbits#90B040: LINE:inbits#608720:'In ' PRINT:inbits:LAST:%6.2lf%s PRINT:inbits:AVERAGE:%6.2lf%s PRINT:inbits_max:MAX:%6.2lf%s PRINT:percentile_in:%6.2lf%s\n AREA:doutbits_max#E0E0FF: AREA:doutbits#8080C0: LINE:doutbits#606090:'Out' PRINT:outbits:LAST:%6.2lf%s PRINT:outbits:AVERAGE:%6.2lf%s PRINT:outbits_max:MAX:%6.2lf%s PRINT:percentile_out:%6.2lf%s\n PRINT:tot:'Total %6.2lf%sB' PRINT:totin:'(In %6.2lf%sB' PRINT:totout:'Out %6.2lf%sB)\l' LINE1:percentile_in#aa0000 LINE1:dpercentile_out#aa0000
1440x604
  5.43M
  9.59M
 13.74M
 13.74Mn
659.36k
779.53k
899.70k
899.70kn
Total 777.41MB
(In 718.94MB
Out  58.46MB)\l
1 Like