# [rrd-users] Clarification on Computing Totals

jeffrey.j.petter at verizon.com jeffrey.j.petter at verizon.com
Tue Apr 15 22:09:20 CEST 2008

```
Hi,

I have been using RRDtool with great success for a few years, and while
those of us on the pointy end of the swords can get what we need from the
graphs, upper management too often calls me needing totals within minutes
for a conference call they are on, or meeting they are in. To combat this,
the no brainer was to write a script, and though I don't profess to be a
real Perl programmer, I can usually get what I need.

In this case though, it's not the code that is confusing me, but something
I read in Alex's "Computing Amount of Data Transferred" tutorial. BTW, I
thought the tutorial was great! I was in the process of writing logic that
would based upon the dates selected, choose the appropriate RRA. I was
elated to read that fetch takes care of that for me....that all the data
will come from the same RRA, hence having the same step size.

My point of confusion is that I would think that to compute the total of,
let's say packets, since that's what I'm dealing with, I would need to
maintain a running total of the (current value * step size). This would
leave me to believe that if the current value was 10 and the step size was
7200 I would have a total of 72000 packets in a two hour period. The math
would be easy as ( 10 packets/second * 7200 seconds ) = ((10 * 7200
packets) * seconds/seconds) = 72000 packets.

However, reading the tutorial, I infer that this is not correct, and I am
having a mental block figuring out why. I am going to paste the piece of
the tutorial that is confusing me, hopefully that will be acceptable.

"Each row in an RRA represents an amount of time and a rate. The rate is
measured in bytes per second, the time in seconds. Some easy math shows
that unless the amount of time is zero, you can get rid of it:
(byte/second)*second = (byte*second)/second = byte*(second/second) =
byte*1=byte.

(If "second" is zero, then "second/second" is undefined. This is why it
doesn't work when second equals zero.)

When dealing with other rates, it works similar. If you have multiplied the
input by 3600 (for instance to get messages per hour) then the result of
the computation in the paragraph above is also 3600 times what it should
be. Remember that when you continue..."

It is the last paragraph that I am most concerned with, for I have
multiplied my packets per second by the step size to achieve the total in
each row - maintaining a running total of the rows, and as I understand the
above, this is incorrect. As I understand the tutorial, I should just be
maintaining a running total of the values, and not multiply them in each
row by the step size. Is that correct?

Thank you,

Jeff Petter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20080415/5f9635e6/attachment.html
```