[rrd-users] Re: Division Bug with RRDTool and RPN Expressions

rodrigo.santos at quantiza.com rodrigo.santos at quantiza.com
Mon Dec 26 14:43:10 MET 2005


Somebody has some suggestion of as I can decide the described problem
below?

Thanks for all.
Rodrigo

---------------------------------------------------------------------
Rodrigo Santos wrote:

I made the update for rrdtool 1.2x, and beyond the diverse errors that
had now started to appear, I read all the documentation in the site
(very confused) e I did not find which the function to use to decide
my problem! I tried to use the VDEF with PERCENT, but it did not
function...

Help me!! Please!!

---------------------------------------------------------------------
Tobias Oetiker wrote:
Rodrigo,
with rrdtool 1.0 there is no way of doing this calculation inside
rrdtool ... with 1.2.x you can use VDEF with this ...

cheers
tobi

---------------------------------------------------------------------
  Today Rodrigo Santos wrote:

  ok, but I do not know what I must modify in my code so that it
  produces the correct result!

  you he could help me? what I must modify so that I have the waited
  result?

  Thanks,
  Rodrigo

---------------------------------------------------------------------
  Tobias Oetiker wrote:

  Rodrigo,

  now I see where you are going wrong ....

  note that rrdtool is dividing discreet values and then builds the
  average of the results. to reproduce you would have to calculate

  a+b+c/3 = x
  e+f+g/3 = y

  a/e + b/f + c/g = z

  now obvously x/y is NOT equal to z

  cheers
  tobi

---------------------------------------------------------------------
  Hello,

  I´m making graphs with rrdtool, but I think that the percentage
  values do not correspond the reality.

  rrdtool graph  totals.png  --imgformat "PNG"  \
  DEF:total_out_bytes=/total.rrd:out_bytes:AVERAGE  \
  DEF:total_in_bytes=/total.rrd:in_bytes:AVERAGE  \
  CDEF:total_bytes=total_out_bytes,total_in_bytes,+  \
  CDEF:total_Mbps=total_bytes,.000008,*  \
  DEF:subnet_out_bytes=/subnet.rrd:out_bytes:AVERAGE  \
  DEF:subnet_in_bytes=/subnet.rrd:in_bytes:AVERAGE  \
  CDEF:subnet_bytes=subnet_out_bytes,subnet_in_bytes,+  \
  CDEF:subnet_Mbps=subnet_bytes,.000008,*  \
  'CDEF:subnet_in_bytes_pct=subnet_in_bytes'  \
  'CDEF:subnet_out_bytes_pct=subnet_out_bytes' \
  'CDEF:subnet_bytes_pct=subnet_bytes'  \
  'CDEF:subnet_Mbps_pct=subnet_Mbps'  \
  'CDEF:total_Mbps_pct=total_Mbps'  \
  'CDEF:div_Mbps_pct=subnet_Mbps,total_Mbps,/'  \
  'CDEF:subnet_pct=subnet_Mbps,100,*,total_Mbps,/'  \
  AREA:subnet_pct:AVERAGE:'subnet %.1lf%%'  \
  GPRINT:subnet_in_bytes_pct:AVERAGE:'subnet IN BYTES %lf'  \
  GPRINT:subnet_out_bytes_pct:AVERAGE:'subnet OUT BYTES %lf'  \
  GPRINT:subnet_bytes_pct:AVERAGE:'subnet BYTES (IN+OUT) %lf'  \
  GPRINT:subnet_Mbps_pct:AVERAGE:'subnet Mbps (BYTES*0.000008) %lf'  \
  GPRINT:total_Mbps_pct:AVERAGE:'total Mbps %lf'  \
  GPRINT:div_Mbps_pct:AVERAGE:'DIV (subnet/TOTAL)Mbps %lf'

  **The results:**

  subnet_in_bytes = 3.2090625
  subnet_out_bytes= 3.2090625
  subnet_bytes    = 6.418125 (IN+OUT) - OK
  subnet_Mbps     = 0.051345 (BYTES*0.000008) - OK
  TOTAL_Mbps      = 0.143296
  div_Mbps        = 0.272552 (subnet_Mbps/TOTAL_Mbps) <========== error

  using a calculator, subnet/TOTAL is 0.358314, but using the RPN
  expression:

  subnet/TOTAL   - 0.171951
  subnet/0.143296- 0.358314 OK
  0.051345/TOTAL - 2.863422 ???

  using a shell command for testing the ksh, worked fine:

  $ echo 0.051345 0.143296 | nawk '{printf("%0.6f\n", $1/$2);}'
  0.358314

  using a perl script for testing the perl, worked too:
  $ perl -e "print 0.051345/0.143296"
  0.358314258597588

  Thanks,
  Rodrigo

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list