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

Chris Mason chris at noodles.org.uk
Sun Dec 11 11:15:24 CET 2011

```Thanks for the response,

> One week is 7 days of 24 hours of 60 minutes of 60 seconds => 604800 seconds.
>
> If you see 3.2GB in a week, then it will be 3,200,000,000 / 604800 bits per second, roughly 5291 bits per second.
>
> If you know the average of 5291, and you know the time range, then just reverse the computation to get 3.2GB:  {\$average} * 604800 = 3.2GB

I see what you are saying and this makes sense, but how do you work
out the seconds for a month as a month could contain between 28 and 31
days - or does rrdtool treat all months as 28 days?

Also, if I don't have a full month worth of data then I will be
over-calculating the total?

> Or just use TOTAL. See the manual page.

I am liking this function and I have the following:

DEF:ifInOctets=<RRD>:ifInOctets:MAX
VDEF:ifInOctetsTotal=ifInOctets,TOTAL
PRINT:ifInOctetsTotal:\'%6.1lf %sB\'

I am storing RRA's with both MAX and AVERAGE CF functions as users
like to be able to see the peaks as well as the averages.

I have read the man page for TOTAL, but I am still slightly confused -
does it use the same theory as above (e.g. multiply the value by the
amount of seconds)? Also, if I don't have a full weeks worth of data,
could it over-calculate?

For this to be accurate I am assuming I really need to use the AVERAGE
DS as opposed to the MAX DS or my values will be too high?

Thanks,
Chris

```