# [rrd-users] Getting Total Bytes from COUNTER Data Source

Chris Mason chris at noodles.org.uk
Sat Dec 24 11:23:04 CET 2011

```[Reposted using links instead of attachments]

Hi,

I have done some further testing using the TOTAL function and I don't
believe the TOTAL function is calculating the value correctly in some
scenarios. To try and explain this easily I have put together two
example recreates:

http://netnix.org/correct.txt
http://netnix.org/incorrect.txt

Please bear with me on this one, but in the examples I have two RRAs -
one with a 5 minute step and another with a 24 hour step. Thanks to
the information that Alex has previously provided I calculated that my
24 hour RRA runs from midnight to midnight. I have manually calculated
the total amount of bytes I have placed into my RRD as follows:

ifOutOctets = 7.158 TB
ifInOctets = 1.458 TB

However, the results I get from rrdgraph (both graphs are covering the
entire data period) are as follows:

(1d - 5m step) ifOutOctets Total = 7.158 TB
(1d - 5m step) ifInOctets Total = 1.458 TB

(1y - 24h step) ifOutOctets Total = 12.126 TB
(1y - 24h step) ifInOctets Total = 2.471 TB

The 5 minute RRA is spot on, but the 24 hour RRA has over calculated
the data. When I looked at my data I noticed I started to put entries
into the RRD at some time after midnight and not at midnight so the
beginning part of the 24 hour RRA would be missing.

I then went and filled my RRD back to midnight duplicating the first
update every 300 seconds - I haven't added or removed bytes. I then
generated the graphs again and the data was spot on:

(1d - 5m step) ifOutOctets Total = 7.158 TB
(1d - 5m step) ifInOctets Total = 1.458 TB

(1y - 24h step) ifOutOctets Total = 7.158 TB
(1y - 24h step) ifInOctets Total = 1.458 TB

I am assuming the data that is missing at the beginning of the RRA
would be considered UNKNOWN and I would expect the TOTAL function to
ignore it?

Thanks,
Chris

```