[rrd-users] need help with figuring out how many minutes furnace is on

Brent Barr b.barr at f5.com
Tue Nov 6 18:58:22 CET 2012


Hello Haroon-  I do something similar, so maybe this might help.  This is my graph generator for one of my building AC units (in a Python system call):

   lsr_ac_rt_19 = os.popen('nice rrdtool graph /var/www/html/tmp/lsr_ac_19_%s.png\
                                    -t "Server Room RT19 10T, %s"\
                                    -W "Generated: %s "\
                                    -w %s -h %s\
                                    --vertical-label Deg_C\
                                    --start "%s:%s %s.%s.%s"\
                                    --end "%s:%s %s.%s.%s"\
                                    --right-axis 1:0\
                                    DEF:linea=lsr_ac_rt-19_1m.rrd:p1:AVERAGE\
                                    DEF:lineb=lsr_ac_rt-19_1m.rrd:p2:AVERAGE\
                                    DEF:linec=lsr_ac_rt-19_1m.rrd:p4:AVERAGE\
                                    DEF:lined=lsr_ac_rt-19_1m.rrd:p6:AVERAGE\
                                    DEF:linee=lsr_ac_rt-19_1m.rrd:p8:AVERAGE:start=-%sh\
                                    DEF:linef=lsr_ac_rt-19_1m.rrd:p9:AVERAGE:start=-%sh\
                                    DEF:lineg=lsr_ac_rt-19_1m.rrd:p10:AVERAGE\
                                    DEF:lineh=lsr_ac_rt-19_1m.rrd:p11:AVERAGE\
                                    CDEF:cd1=linea,32,-,0.555,*\
                                    CDEF:cd2=lineb,32,-,0.555,*\
                                    CDEF:cd3=linec,32,-,0.555,*\
                                    CDEF:cd4=lined,32,-,0.555,*\
                                    CDEF:cd5=linee,5,*\
                                    CDEF:cd6=linef,5,*\
                                    CDEF:cd7=linee,linef,+,5,*\
                                    CDEF:onavg=cd7,3600,TRENDNAN\
                                    CDEF:vd2=cd7,10,*\
                                    CDEF:cd9=lineh,5,*\
                                    CDEF:cd10=lineg,5,*\
                                    VDEF:vd1=vd2,AVERAGE\
                                    AREA:cd5#5555FF88::\
                                    AREA:cd6#AAAAFF88::STACK\
                                    LINE2:cd1#FF660088:"Room Temp"\
                                    LINE2:cd2#00BB00AA:"Supply Temp"\
                                    LINE2:cd3#0000FF88:"Occ Cool Stpt"\
                                    LINE2:cd4#00009988:"UnOcc Cool Stpt"\
                                    LINE1:cd5#5555FF66:"Cool Y1"\
                                    LINE1:cd6#AAAAFF66:"Cool Y2":STACK \
                                    LINE2:onavg#00CCFF:"1 hour average"\
                                    LINE2:cd9#FF0000:"Heating"\
                                    LINE2:cd10#FF0000:"Heating"\
                                    COMMENT:"Average cooling in window\:"\
                                    GPRINT:vd1:"%%2.1lf"\
                                    COMMENT:"%%"' % (name, name2, [now.month, now.day, now.year], width, height, shour, smin, sdate[1], sdate[0], sdate[2], ehour, smin, edate[1], edate[0], edate[2], estart, estart) )


The interesting part are these lines:
                                    DEF:linee=lsr_ac_rt-19_1m.rrd:p8:AVERAGE:start=-%sh\    # Cooling Y1
                                    DEF:linef=lsr_ac_rt-19_1m.rrd:p9:AVERAGE:start=-%sh\     # Cooling Y2
                                    CDEF:cd7=linee,linef,+,5,*\
                                    CDEF:vd2=cd7,10,*\
                                    VDEF:vd1=vd2,AVERAGE\
                                    COMMENT:"Average cooling in window\:"\
                                    GPRINT:vd1:"%%2.1lf"\

That puts a number at the bottom that shows the percentage that the cooling was on, for the displayed chart.  So I can do a 6 hour, 1 day, 1 week (etc) chart and see what the percentage cooling I am using.  Note that I have two stages of cooling no this unit, so 100% cool is when both stages are on.  Since my data is either 1 or 0 in the RRDT, I scale up the data to 5 for 1 unit on, and 10 for both units on.  That lets me see it easily on a typical 0-25C scale, without having it overlap my temperature data.

(Will try to attach a picture)

One thing I have not figured out yet is to make the comment, number and percent sign stick next to each other.  If you can see the attachment, it has spaced out those items across the entire bottom of the chart.

Hope that helps-




More information about the rrd-users mailing list