Search code examples
networkingbandwidthgraphingrrdtool

How do I create accumulated bandwidth usages in RRDtool (ie. GB's per month down)?


The following data comes from a mobile phone provider, it's a list of kb's downloaded at a certain time, usually on a per minute basis.

It's not the average, not the max, but the total of that time interval, which allows to track the data consumption precisely. These graphs were made with PIL, and instead of showing spikes to indicate a large data consumption, large steps can be seen, which is much more revealing, because it doesn't just tell "much happened here", but "exactly this much happened here". For example second graph Sat 10 at night 100mb. A rate-change graph wouldn't be as informative.

I'm also trying to find a way to do this with rrd.

I was mislead when using the COUNTER to track my networks data usage into thinking that I would be able to precisely compute the monthly/weekly accumulated data usage, but now it turned out to be a wrong assumption.

How I store my data in rrd in order to be able to easily generate graphs like below? Would that be by using ABSOLUTE and before updating it I would subtract the previous insertion value? Would that be precise down to the byte when checking the monthly usage?

User 1

User 2


Solution

  • You can add up all the value in your chart quite easily:

    CDEF:sum=data,$step_width,*,PREV,ADDNAN

    if your chart covers just one month, that should be all you have todo. If you want to have it cover multiple months, you will have to use a combination of IF and TIME operators to reset the line to 0 at the start of the month.

    Version 1.5.4 will contain an additional operator called STEPWIDTH, which pushes the step width onto the stack, making this even simpler.