[rrd-users] VRULE for sunset, sunrise

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Aug 26 17:27:09 CEST 2007


On Sun, Aug 26, 2007 at 06:45:52AM -0700, Joseph Mack NA3T wrote:

> I'm collecting weather data and would like to plot the 
> sunrise and sunset time with a VRULE. It seems that VRULE 
> must be passed a number, rather than whatever is in a 
> DEF/CDEF variable. I can extract sunset/sunrise into shell 
> variables and plot them with VRULE, but I'd like to be able 
> to save the sunrise/sunset times into a rrd database and 
> recall them later.

Do you want to plot those times, or does it HAVE to be using vrule ?

I can think of ways to achieve what you apparently want. Those ways
do not include VRULE.

First thing to consider: rrdtool works with intervals, not with
times (except vrule, which won't work afaik).

You'll have to deal with consolidation, and want to distinguish
between relevant times (sunset, sunrise) and irrelevant times.

The database resolution needs to be in the same resolution as you
want your data. If you have 86400 seconds per rra-row, you won't
be able to have two different times (time ranges really). This
means: use one minute per row, or even one second.

Then think about what you want to see. Do you want a spike at
sunrise and sunset, or do you want to display daylight and night?

Intervals have a beginning, duration and end. Suppose you want to
display the period between sunrise and sunset, you do want to include
the interval which ends at sunset but you do NOT want to include the
interval which ends at sunrise.

If on the other hand you want spikes, you need mostly UNKN or zero
in your database, with an occasional INF or high value.

In both cases: I'm not sure what happens when {UN,UN,UN,UN,INF,UN,UN,UN}
(for example) is consolidated. Try it. If that results in INF then
you could use UNKN for graph off and INF for graph on (be it a spike
or a range). Else, use zero and a huge value, then use a CDEF to
find the difference between zero and non-zero. Change non-zero into
INF and continue.

Graphing is a matter of displaying the resulting data. INF results
in a bar upto the top of the graph, UNKN or zero won't be visible.

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the rrd-users mailing list