# [rrd-users] [GRAYMAIL] Re: Re: RE: RE: Question about trend line

rseiwert rob at vcaglobal.com
Tue Aug 18 20:30:33 CEST 2015

I think I might have gotten bumped off the list as I don't see my replies.
Ondrej, hope this reaches you.
While your data may have a step of 300 secs and you might even set the step
size on the command line or even on the  rrd datasource def this is not the
step size used. The step used will be the number of seconds that can fit in
one pixel. You can force the step by controlling the image resolution and
the time range or just calculate the step knowing the image resolution and
time range. In some of my scripts I force an image resolution of 4k so that
step size can be 60 secs. This actually allows me to use the rate of change
in a meaningful way. If my LSLSlope is 10Mb and my step is 60 that's
10Mb/min.

Inside RRD I calculate the stepwidth with the following.

CDEF:c=var1,COUNT,EXC,POP       --- The count of steps as a data set from 1
to end of chart
CDEF:t=var1,TIME,EXC,POP           --- time range of graph as a data set
VDEF:tmin=t,MINIMUM                --- starting time
VDEF:tmax=t,MAXIMUM              --- ending time
VDEF:cmax=c,MAXIMUM              --- count of steps plus one
CDEF:s=var1,POP,tmax,tmin,-,cmax,1,-,/   --- data set of stepwidth,
calculated from (end time - start time) / (count -1)
VDEF:stepwith=s,MAXIMUM     --- stepwidth as a single value

Cannot do RPN on a VDEF so do the math into a dataset, then pull a value.
Max or Min doesn't matter. Every value is the same.

Inside RRD 1.5.4 there is a function  STEPWIDTH. The width of the current
step in seconds. This is a fairly recent version. You can use this to get
the step size with fewer calculations.
CDEF:step=var1,STEPWIDTH,EXC,POP
VDEF:stepw=step,MAXIMUM

Now if I could get some to tell me how to gprint this as
Days:Hours:Mins:Secs. When I look at a one year graph I GPRINT the stepwidth
on the graph but what is a step of 64.8k seconds? 7.5 days would be much
more clear. That info combined with the slope of say 10GB tells me my rate
of change is 10GB every week (roughly). Now if I could get seconds to scale
like bytes do with SI units for time.

--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Question-about-trend-line-tp7583077p7583108.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.