I'm using RRDTOL to plot the temperatures for the last 36 hours on a graph. It looks pretty cool:
In the rrd itself I'm saving the temperature every minute, and have been doing so for a few weeks. What I'm trying to do is compare the last 36 hours to the preceding 24 hours (compare 2AM last night, to 2AM the previous day, etc.).
I'm using BASH to draw the graphs. Here's the code I use to draw the graph:
# DRAW 36-Hour graph
/usr/bin/rrdtool graph "$PWD"/outday.png \
--start now-36h --end now \
--alt-autoscale \
-w 425 -h 200 \
--full-size-mode \
--title "Last 36 hours" \
--color CANVAS#36393f00 \
--color BACK#36393f00 \
--color FONT#5b80e0 \
--color GRID#888888 \
--color MGRID#888888 \
--color SHADEA#36393f00 \
--color SHADEB#36393f00 \
--border 0 \
--x-grid HOUR:6:HOUR:80:HOUR:6:0:"%H:%M" \
--left-axis-format %2.0lf \
--watermark "$(date +'%a %b %d %H:%M %Z %Y')" \
DEF:tempo=/usr/local/bin/temp/tempo.rrd:tempo:AVERAGE \
CDEF:up=tempo,0,*,0,EQ,0,1,IF \
TICK:up#3b455e:1.0 \
LINE2:tempo#5b80e0 \
GPRINT:tempo:AVERAGE:" Average\:%2.1lf" \
GPRINT:tempo:MAX:"Maximum\:%2.0lf " >/dev/null
I like the way it looks (looks even better on a dark background).
Here's what I tried (doesn't produce any errors when running):
/usr/bin/rrdtool graph "$PWD"/outday2.png \
--start now-36h --end now \
--alt-autoscale \
-w 425 -h 200 \
--full-size-mode \
--title "Last 36 hours" \
--color CANVAS#36393f00 \
--color BACK#36393f00 \
--color FONT#5b80e0 \
--color GRID#888888 \
--color MGRID#888888 \
--color SHADEA#36393f00 \
--color SHADEB#36393f00 \
--border 0 \
--x-grid HOUR:6:HOUR:80:HOUR:6:0:"%H:%M" \
--left-axis-format %2.0lf \
--watermark "$(date +'%a %b %d %H:%M %Z %Y')" \
DEF:tempo=/usr/local/bin/temp/tempo.rrd:tempo:AVERAGE:end=now \
DEF:tempo2=/usr/local/bin/temp/tempo.rrd:tempo:AVERAGE:end=now-24h:start=now-60h \
CDEF:up=tempo,0,*,0,EQ,0,1,IF \
TICK:up#3b455e:1.0 \
LINE2:tempo#5b80e0 \
LINE2:tempo2#5b80e0 \
GPRINT:tempo:AVERAGE:" Average\:%2.1lf" \
GPRINT:tempo:MAX:"Maximum\:%2.0lf " >/dev/null
Obviously the lines I'm changing are the DEF:tempo2
and LINE2:tempo2
ones. But even when I run this with no errors, The expected second line is just not there.
I suspect that the problem I'm having is that the timeframe is screwing me over somehow, and that I'll need to "edit" the times to shift the second line to the right somehow. But i'm not sure how to do that.