Bernhard Schmidt wrote: > Hello, > > I'm using rrdtool to graph a very simple single GAUGE counter (the > number of active IPv6 hosts in a part of our network) into a simple RRD > file with a stepsize of 3600 seconds and without any aggregation. > > To get a better visible trend from the data I was trying to use the > TREND or TRENDNAN function with a one day and one week sliding average > > rrdtool graph -l 50 -r -h 400 -w 800 ipv6.png \ > -s end-3w \ > DEF:hosts=/root/ipv6hosts.rrd:hostcount:AVERAGE \ > CDEF:hosts1d=hosts,86400,TREND \ > CDEF:hosts1w=hosts,604800,TREND \ > LINE2:hosts#0000ff:Hosts \ > LINE1:hosts1w#ff0000 \ > LINE1:hosts1d#00ff00 > > As you can see in the resulting graphs for the 1-week, 2-week and 3-week > graphs at > > http://svr02.teleport-iabg.de/~bschmidt/ipv6-1w.png > http://svr02.teleport-iabg.de/~bschmidt/ipv6-2w.png > http://svr02.teleport-iabg.de/~bschmidt/ipv6-3w.png > > the sliding window for one week (red line) is not available in the first > week of the graph, even though there is older data in the RRD file. Same > for the daily trend which is not available in the first 24h of the > graph. Is this expected or a bug? TRENDNAN in more recent rrdtool > versions doesn't help. This is rrdtool 1.3.1.
Hi Bernhard, I've had the same problem and the solution for it isn't obvious, but pretty easy: By default, rrdgraph fetches data from the DB from start to end, however, if you want a trend with an average of 1 week, of course the first average point will be available AFTER 1 week since the data has been fetched already and there is no access to the data of start-1w ... Solution: You need to fetch data from the DB *BEFORE* your viewing time window. In your above example, this should do the job: change > DEF:hosts=/root/ipv6hosts.rrd:hostcount:AVERAGE \ into > DEF:hosts=/root/ipv6hosts.rrd:hostcount:AVERAGE:start=end-4w \ you may even need to prefetch a little more than 1w, so perhaps you need to > DEF:hosts=/root/ipv6hosts.rrd:hostcount:AVERAGE:start=end-8d \ correction: of course I meant (-3w -8d), so 29d or even 30d try: > DEF:hosts=/root/ipv6hosts.rrd:hostcount:AVERAGE:start=end-30d \ Hope that helps ... - Karl _______________________________________________ rrd-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
