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

Simon Hobson linux at thehobsons.co.uk
Sun Dec 11 12:38:17 CET 2011


Chris Mason wrote:

>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?

RRD tool doesn't have any concept of months except for labelling the 
time axis on a graph. Internally it just uses seconds since Unix 
epoch. If you want to do something over a calendar month, then you'll 
need to work out the start and end times.

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

Probably.

BTW - there is also now a TOTAL function which will do the totting up for you.

And, in a DEF you can specify a time period different to that of a 
graph. I use this at work where my graphs a bit longer than the 
nominal period - eg my "week" graph is actually about 10 days as 
that's what fits in a convenient width graph without aliasing.

I ge the total transfer for a period (eg a week rather than the 10 
days in the graph) with just 2 lines :

 
DEF:totin=${RRDName1}:in:AVERAGE:step=${Step}:start=end-${Period}:end=${Etime}

VDEF:vtotin=totin,TOTAL

This is within a Bash script, so the various values have been 
calculated/set previously.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list