[rrd-users] Graph per month - is it possible?

Maris Janis Vasilevskis mahris at myself.com
Sat Apr 2 23:13:22 CEST 2011


Hi,

I wish to get year graph with 12 values, one per month. Currently, I could not find any way to do it.
Has anybody a positive experience?

I tried to join 12 lines with different start, step and end - and I got even more strange results.
I use 1.4.5 compiled on Linux exactly according to http://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html
I call rrdtool from C++, but I performed also command line tests.

In following excerpts, I use dates and expressions for readability.
In reality, I use only numbers - seconds for step, seconds from epoch for start and end.

rrdtool create test.rrd --step 1 --start -2year DS:cpu:GAUGE:600:0:100
RRA:AVERAGE:0.5:24*3600:720
There are also RRAs for week, hour and minute.
To be safe about last year data, I filled database with test values for 2 years (update with step 10 secs).

rrtool graph --end now --start end-14month
DEF:avr4=test.rrd:cpu:AVERAGE:step=30*24*3600:start=1Apr2010:end=1May2010
LINE:avr4#FF0000
DEF:avr5=test.rrd:cpu:AVERAGE:step=31*24*3600:start=1May2010:end=1Jun2010
LINE:avr5#FF0000
...

I get results for some months only, most part of graph is empty.

To understand what is happening, I removed end from DEFs and tested with single DEF.
DEF:avr4=test.rrd:cpu:AVERAGE:step=30*24*3600:start=1Apr2010
Normal graph from Apr 1 to now
DEF:avr5=test.rrd:cpu:AVERAGE:step=31*24*3600:start=1May2010
Start somewhere at end of May, possibly May 30.
Similarly, for most months graph starts in one of last days.
Exceptions: Apr 2010 and Mar 2011 seem to work normally, Feb 2011 starts near to the month beginning.

Has anybody some ideas or tricks to get monthly data?

Thank you,
Mahris

P.S. Recently performed some operations on calculator.
It seems that real graph start always should contain whole number of steps from epoch (Jan 1, 1970).
In my case, Apr 1 2010 = 14700 days from epoch, and this number divides with step 30 days.
Feb 3 2011 divides by 28, Mar 2 2011 divides by 31 - I erroneously identified graphs from 1 as complete month.
Why such a rule and is there any workaround?



More information about the rrd-users mailing list