# [rrd-users] Can you use the graphed time interval in a CDEF function?

Marc MERLIN marc_rrd at merlins.org
Wed Nov 18 09:02:33 CET 2009

```On Fri, Nov 13, 2009 at 05:41:47PM +0000, A Darren Dunham wrote:
> On Fri, Nov 13, 2009 at 07:11:54AM -0800, Marc MERLIN wrote:
> > If I'm graphing something like this
> > http://gargamel.merlins.org/cacti/graph.php?action=zoom&local_graph_id=19&rra_id=0&view_type=&graph_start=1258012800&graph_end=1258099199&graph_height=320&graph_width=800&title_font_size=10
> >
>
> Those labels seem odd to me.  If you're measuring power at a point in
> time, wouldn't that be in Kw, not Kwh (a unit of energy)?

True, I should label kw.

> > Is there a way to take my average values and auto-multiply them by the time
> > range?
> > That way if I take avg val * 24H in the graph above it would give me
> > Kwh/day.
>
> I don't see why you'd want to depend on the time range of the graph.  If
> your graph was 22 hours, wouldn't you still want to see Kwh/day and
> therefore still multiply by 24?

No. I might want to see a week's worth or a month's worth or whatever range
I zoomed on.
For instance how much electricity did I use in august, or how much AC did I
use last week.

> If you do want the time range, I think you'd have to graph something
> twice.  The first one doesn't have to have all the data, but you can get
> the range info from it with graphv.  Then use that information to create
> the second graph.

I'm not familiar with graphv, but can I do it on a dynamic basis based on
the range I just selected to render as a rrdtool graph with cacti or from
the command line?

Thanks,
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking