[rrd-users] VRULE for sunset, sunrise

Joseph Mack NA3T jmack at wm7d.net
Mon Aug 27 16:57:21 CEST 2007


On Mon, 27 Aug 2007, Alex van den Bogaerdt wrote:

> On Sun, Aug 26, 2007 at 09:12:42AM -0700, Joseph Mack NA3T wrote:
>
>> Since putting midnight on the graph was so easy with VRULE,
>> I assumed for the day graph of temp/humidity, a VRULE for
>> sunrise/sunset, would be equally easy.
>
> And it is. You don't know the time of midnight from your RRD,
> do you?  RRDtool knows about rates during time intervals, not
> about timestamps.
>
> Your problem is where to get the data. I suggest a separate
> file or database (not an RRD).

yes that was how I got it to work in the first attempt. I 
had hoped to use sunset/sunrise in the RRD.

>>> I can think of ways to achieve what you apparently want. Those ways
>>> do not include VRULE.
>
> It seems that your goal is not to store sunset/sunrise in the RRD.
> In that case my statement was wrong.

I want it in the RRD, so I can plot it as a graph, for the 
year graph, but I'd like to show the day/night somehow for 
any particular day.


>
> New try:
>
> In pseudo_but_almost_real_bash_and_SQL:
>
> echo -n 'rrdtool graph' > rrdtool_commands
> [... rrdtool command list is built here ...]
> for vrule in `
>   sql select sunrise from sun_table
>     where timedate < rrdtool_graph_end_time_and_date
>       and timedate > rrdtool_graph_start_time_and_date
>   sql select sunset from sun_table
>     where timedate < rrdtool_graph_end_time_and_date
>       and timedate > rrdtool_graph_start_time_and_date
>  `
> do
>  echo " VRULE:$vrule" >> rrdtool_commands
> done
> [... rest of rrdtool command list is built here ...]
> ./rrdtool_commands
>
>
>> If VRULE is not going to do it, how about I just shade
>> between sunrise and sunset? To do that, I can extract the
>> current value of sunrise and sunset and shade between them
>> (presumably I can test LTIME when setting the background and
>> see if it's less than sunset AND more that sunrise).
>>
>> However how would I shade for yesterday? Instead of using
>> LTIME, do I calculate
>>
>> LTIME,86400,-
>
> I think you have to use the modulo function for this. You want
> LTIME,86400,%
> and then [... quote from earlier in your message...]

I was trying to retreive yesterday's sunset/sunrise time and 
so thought I'd need LTIME for yesterday.

>> (presumably I can test LTIME when setting the background and
>> see if it's less than sunset AND more that sunrise).
>
> Here sunset and sunrise are time-of-day, and that LTIME combined
> with a modulo function also returns time-of-day.
>
> But this is for shading, not for those vrules.

shading is fine.

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the rrd-users mailing list