[rrd-users] VRULE for sunset, sunrise
Alex van den Bogaerdt
alex at ergens.op.het.net
Mon Aug 27 14:52:29 CEST 2007
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).
> >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.
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...]
> (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.
HTH
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list