[rrd-users] Background color for day- and night-time and weekends

Alexander Skwar alexanders.mailinglists+nospam at gmail.com
Thu Aug 27 12:56:45 CEST 2009


Hi.

I would like my graphs to "highlight" day and night time and also weekends.
For this, I found somewhere (maybe here?
http://n2.nabble.com/change-background-for-special-timeperiods-tp1073392p1073397.html)
the following:

    CDEF:cdefa=LTIME,86400,%,28800,GT,LTIME,86400,%,64800,LT,INF,UNKN,a,*,IF,UNKN,a,*,IF
\
    CDEF:cdefb=LTIME,86400,%,28800,LT,INF,LTIME,86400,%,64800,GT,INF,UNKN,a,*,IF,IF
\
    CDEF:cdefc=LTIME,604800,%,172800,GT,LTIME,604800,%,345600,LT,INF,UNKN,a,*,IF,UNKN,a,*,IF
\
\
    AREA:cdefa#F9FD5F7F:""  \
    AREA:cdefb#F5F8007F:""  \
    AREA:cdefc#C0C0C0B2:""  \

This works quite well, as can be seen on the following graph:
http://drop.io/khfqhjn/asset/rrd-bg-daynight-gap-png

BUT: You can see there, that there's a small gap between day and night time
background. When zooming in on the image, it can be seen, that the nighttime
background goes from 18:00 to 07:30, and the daytime background starts at
08:00 and ends at 17:30. This means, that there's a gap 07:30 → 08:00 and
17:30 → 18:00, which is drawn in plain white.

Where does this gap come from? I mean, quite obvious, it comes from a not
correct CDEF, but how would correct CDEF definitions look like? :) Daytime
should be 08:00 → 18:00 and nighttime 18:00 → 08:00. Weekend should be
Saturday 00:00 → Sunday 23:59 (or Monday 00:00).

Thanks a lot,
Alexander

For your reference, here's the complete Cacti generated rrdtool
command line:

rrdtool graph - \
--imgformat=PNG \
--start=1251088885 \
--end=1251130659 \
--title="Application Performance" \
--base=1000 \
--height=200 \
--width=600 \
--alt-autoscale \
--units-exponent=1 \
COMMENT:"From 2009-08-24 06\:41\:25 To 2009-08-24 18\:17\:39\c" \
COMMENT:"  \n" \
--vertical-label="seconds" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="BSB.rrd":BSB:LAST \
DEF:b="FHI.rrd":FHI:LAST \
DEF:c="SVN.rrd":SVN:LAST \
DEF:d="WIN.rrd":WIN:LAST \
\
    CDEF:cdefa=LTIME,86400,%,28800,GT,LTIME,86400,%,64800,LT,INF,UNKN,a,*,IF,UNKN,a,*,IF
\
    CDEF:cdefb=LTIME,86400,%,28800,LT,INF,LTIME,86400,%,64800,GT,INF,UNKN,a,*,IF,IF
\
    CDEF:cdefc=LTIME,604800,%,172800,GT,LTIME,604800,%,345600,LT,INF,UNKN,a,*,IF,UNKN,a,*,IF
\
\
AREA:cdefa#F9FD5F7F:""  \
AREA:cdefb#F5F8007F:""  \
AREA:cdefc#C0C0C0B2:""  \
LINE1:a#4444FFFF:"BSB"  \
GPRINT:a:LAST:"      Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:b#6DC8FEFF:"FHI"  \
GPRINT:b:LAST:"      Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:c#00A348FF:"SVN"  \
GPRINT:c:LAST:"      Current\:%8.2lf %s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:d#FF0000FF:"WIN"  \
GPRINT:d:LAST:"      Current\:%8.2lf %s"  \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf %s\n"


Alexander
--
[[ http://zensursula.net ]]
[ Soc. => http://twitter.com/alexs77 | http://www.plurk.com/alexs77 ]
[ Mehr => http://zyb.com/alexws77 ]
[ Chat => Jabber: alexws77 at jabber80.com | Google Talk: a.skwar at gmail.com ]
[ Mehr => AIM: alexws77 ]
[ $[ $RANDOM % 6 ] = 0 ] && rm -rf / || echo 'CLICK!'



More information about the rrd-users mailing list