Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-8372

Totals based on {diffTime} on any graph templates related with octets are wrong

    XMLWordPrintable

    Details

      Description

      For RRDtool, there is an accurate way to calculate the total amount of bytes (i.e. octets) for a period of time using what they call VDEF.

      Here is a working example for it:

       DEF:octIn={rrd1}:ifHCInOctets:AVERAGE \
       DEF:octOut={rrd2}:ifHCOutOctets:AVERAGE \
      ...
       VDEF:inSum=octIn,TOTAL \
       VDEF:outSum=octOut,TOTAL \
      

      Unfortunately, VDEF is not supported on Backshift, and the workaround (which is using diffTime) doesn't work either.

      The problem is that the graph definition was based on the "bits" version of the source, instead of the "bytes" version of the source, and the idea is to show the "total bytes", but what you are actually getting is the "total bits".

      Current Invalid Definition
      report.mib2.HCbits.name=Bits In/Out (High Speed)
      report.mib2.HCbits.suppress=mib2.bits
      report.mib2.HCbits.columns=ifHCInOctets,ifHCOutOctets
      report.mib2.HCbits.type=interfaceSnmp
      report.mib2.HCbits.command=--title="Bits In/Out (High Speed)" \
       --vertical-label="Bits per second" \
       DEF:octIn=[rrd1]:ifHCInOctets:AVERAGE \
       DEF:minOctIn=[rrd1]:ifHCInOctets:MIN \
       DEF:maxOctIn=[rrd1]:ifHCInOctets:MAX \
       DEF:octOut=[rrd2]:ifHCOutOctets:AVERAGE \
       DEF:minOctOut=[rrd2]:ifHCOutOctets:MIN \
       DEF:maxOctOut=[rrd2]:ifHCOutOctets:MAX \
       CDEF:rawbitsIn=octIn,8,* \
       CDEF:minRawbitsIn=minOctIn,8,* \
       CDEF:maxRawbitsIn=maxOctIn,8,* \
       CDEF:rawbitsOut=octOut,8,* \
       CDEF:minRawbitsOut=minOctOut,8,* \
       CDEF:maxRawbitsOut=maxOctOut,8,* \
       CDEF:rawbitsOutNeg=0,rawbitsOut,- \
       CDEF:rawtotBits=octIn,octOut,+,8,* \
       CDEF:bitsIn=rawbitsIn,UN,0,rawbitsIn,IF \
       CDEF:bitsOut=rawbitsOut,UN,0,rawbitsOut,IF \
       CDEF:totBits=rawtotBits,UN,0,rawtotBits,IF \
       CDEF:outSum=bitsOut,[diffTime],* \
       CDEF:inSum=bitsIn,[diffTime],* \
       CDEF:totSum=totBits,[diffTime],* \
       AREA:rawbitsIn#73d216 \
       LINE1:rawbitsIn#4e9a06:"In " \
       GPRINT:rawbitsIn:AVERAGE:"Avg  \\: %8.2lf %s" \
       GPRINT:rawbitsIn:MIN:"Min  \\: %8.2lf %s" \
       GPRINT:rawbitsIn:MAX:"Max  \\: %8.2lf %s\\n" \
       AREA:rawbitsOutNeg#729fcf \
       LINE1:rawbitsOutNeg#3465a4:"Out" \
       GPRINT:rawbitsOut:AVERAGE:"Avg  \\: %8.2lf %s" \
       GPRINT:rawbitsOut:MIN:"Min  \\: %8.2lf %s" \
       GPRINT:rawbitsOut:MAX:"Max  \\: %8.2lf %s\\n" \
       GPRINT:inSum:AVERAGE:"  Tot In  \\: %8.2lf %s" \
       GPRINT:outSum:AVERAGE:" Tot Out  \\: %8.2lf %s" \
       GPRINT:totSum:AVERAGE:" Tot  \\: %8.2lf %s\\n"
      
      Correct Definition
      report.mib2.HCbits.name=Bits In/Out (High Speed)
      report.mib2.HCbits.suppress=mib2.bits
      report.mib2.HCbits.columns=ifHCInOctets,ifHCOutOctets
      report.mib2.HCbits.type=interfaceSnmp
      report.mib2.HCbits.command=--title="Bits In/Out (High Speed)" \
       --vertical-label="Bits per second" \
       DEF:octIn=[rrd1]:ifHCInOctets:AVERAGE \
       DEF:octOut=[rrd2]:ifHCOutOctets:AVERAGE \
       CDEF:rawbitsIn=octIn,8,* \
       CDEF:rawbitsOut=octOut,8,* \
       CDEF:rawbitsOutNeg=0,rawbitsOut,- \
       CDEF:bytesIn=octIn,UN,0,octIn,IF \
       CDEF:bytesOut=octOut,UN,0,octOut,IF \
       CDEF:outSum=bytesOut,[diffTime],* \
       CDEF:inSum=bytesIn,[diffTime],* \
       CDEF:totSum=outSum,inSum,+ \
       AREA:rawbitsIn#73d216 \
       LINE1:rawbitsIn#4e9a06:"In " \
       GPRINT:rawbitsIn:AVERAGE:"Avg  \\: %8.2lf %s" \
       GPRINT:rawbitsIn:MIN:"Min  \\: %8.2lf %s" \
       GPRINT:rawbitsIn:MAX:"Max  \\: %8.2lf %s\\n" \
       AREA:rawbitsOutNeg#729fcf \
       LINE1:rawbitsOutNeg#3465a4:"Out" \
       GPRINT:rawbitsOut:AVERAGE:"Avg  \\: %8.2lf %s" \
       GPRINT:rawbitsOut:MIN:"Min  \\: %8.2lf %s" \
       GPRINT:rawbitsOut:MAX:"Max  \\: %8.2lf %s\\n" \
       GPRINT:inSum:AVERAGE:"  Tot In  \\: %8.2lf %sBytes" \
       GPRINT:outSum:AVERAGE:" Tot Out  \\: %8.2lf %sBytes" \
       GPRINT:totSum:AVERAGE:" Tot  \\: %8.2lf %sBytes\\n"
      

      Note: I replaced curly brackets with square brackets, because the first ones have a special meaning on Jira. They have to be curly brackets on the graph definitions.

      Note that I removed all the things that are not required and don't make sense to have for RRDtool/JRobin.

      Also note that the numbers shown are not going to be as accurate as the VDEF version, specially if there are lots of NaNs on the graph.

        Attachments

          Activity

            People

            • Assignee:
              tarus Tarus Balog
              Reporter:
              agalue Alejandro Galue
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: