[rrd-users] formatting the rrdtool graph commands/scripts
Andreas Schuldei
andreas+rrdtool at schuldei.org
Thu Nov 2 00:06:44 CET 2017
Hi,
I am looking for inspiration for formatting my rrdtool graph commands.
given that this is some form of prgramming, i would like to extract common
parts like the preamble which is similar in many of my graphs, or format
the script so the meaning becomes more obvious. Many of my graph commands
are longish (80lines) and are hard to grock after a while. How do you deal
with this?
this is an example graph
===========
#!/bin/bash
rrdtool graph Energiebilanz_Kessel.png \
--start='20171031 09:05' \
--end='20171031 16:00' \
--height=500 \
--title='Energiebilanz Kessel' \
--base=1000 \
--width=1000 \
--imgformat=PNG \
--interlaced \
--slope-mode \
DEF:b=data/temperature-Kessel_Vorlauf.rrd:value:AVERAGE \
DEF:b_min=data/temperature-Kessel_Vorlauf.rrd:value:MIN \
DEF:b_max=data/temperature-Kessel_Vorlauf.rrd:value:MAX \
DEF:a=data/temperature-Kessel_Rücklauf.rrd:value:AVERAGE \
DEF:a_min=data/temperature-Kessel_Rücklauf.rrd:value:MIN \
DEF:a_max=data/temperature-Kessel_Rücklauf.rrd:value:MAX \
DEF:c=data/counter-Kessel_Durchsatz.rrd:value:AVERAGE \
CDEF:D=b,a,-,c,80,TREND,*,10,*,1.163,* \
CDEF:E=c,80,TREND,100,* \
CDEF:F=b,a,- \
VDEF:G=D,TOTAL \
LINE1:a#28a9c9:' Kessel Rücklauf\t\t'\
VDEF:a_MIN=a_min,MINIMUM \
GPRINT:a_MIN:'Min\: %6.2lf%s\t'\
VDEF:a_AVERAGE=a,AVERAGE \
GPRINT:a_AVERAGE:'Avg\: %6.2lf%s\t' \
VDEF:a_MAX=a_max,MAXIMUM \
GPRINT:a_MAX:'Max\: %6.2lf%s\t' \
VDEF:a_LAST=a,LAST \
GPRINT:a_LAST:'Last\: %6.2lf%s\n' \
LINE1:b#c98028:' Kessel Vorlauf\t\t'\
VDEF:b_MIN=b_min,MINIMUM \
GPRINT:b_MIN:'Min\: %6.2lf%s\t' \
VDEF:b_AVERAGE=b,AVERAGE \
GPRINT:b_AVERAGE:'Avg\: %6.2lf%s\t' \
VDEF:b_MAX=b_max,MAXIMUM \
GPRINT:b_MAX:'Max\: %6.2lf%s\t' \
VDEF:b_LAST=b,LAST \
GPRINT:b_LAST:'Last\: %6.2lf%s\n' \
LINE1:D#66350d:' Leistung des Kessels [kW]\t'\
VDEF:D_AVERAGE=D,AVERAGE \
GPRINT:D_AVERAGE:'\t\t Avg\: %6.2lf%s\t'\
VDEF:D_LAST=D,LAST \
GPRINT:D_LAST:'\t\t Last\: %6.2lf%s\n'\
LINE1:E#00FF00:' Liter Warmwasser\t\t'\
VDEF:E_MIN=E,MINIMUM \
GPRINT:E_MIN:'Min\: %6.2lf%s\t'\
VDEF:E_AVERAGE=E,AVERAGE \
GPRINT:E_AVERAGE:'Avg\: %6.2lf%s\t'\
VDEF:E_MAX=E,MAXIMUM \
GPRINT:E_MAX:'Max\: %6.2lf%s\n'\
LINE1:F#28c933:' Temperaturdifferenz\t\t'\
VDEF:F_MIN=F,MINIMUM \
GPRINT:F_MIN:'Min\: %6.2lf%s\t'\
VDEF:F_AVERAGE=F,AVERAGE \
GPRINT:F_AVERAGE:'Avg\: %6.2lf%s\t'\
VDEF:F_MAX=F,MAXIMUM \
GPRINT:F_MAX:'Max\: %6.2lf%s\t'\
VDEF:F_LAST=F,LAST \
GPRINT:F_LAST:'Last\: %6.2lf%s\n' \
GPRINT:G:' Gesamtenergie [kWh] %6.2lf%s\n' \
CDEF:a_diff=a_max,a_min,- \
LINE:a_min \
AREA:a_diff#7db6c480::STACK \
CDEF:b_diff=b_max,b_min,- \
LINE:b_min \
AREA:b_diff#c69f6f80::STACK \
CDEF:f_min=a,a_min,-,b,b_min,-,+ \
CDEF:f_max=a_max,a,-,b_max,b,-,+ \
CDEF:f_diff=f_max,f_min,+ \
CDEF:f_low=F,f_min,- \
LINE:f_low \
AREA:f_diff#85c68980::STACK \
CDEF:f_min_rel=f_min,F,/ \
CDEF:f_max_rel=f_max,F,/ \
CDEF:d_min=D,f_min_rel,* \
CDEF:d_max=D,f_max_rel,* \
CDEF:d_low=D,d_min,- \
LINE:d_low \
CDEF:d_diff=d_min,d_max,+ \
AREA:d_diff#705e4f80::STACK \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.oetiker.ch/pipermail/rrd-users/attachments/20171101/d574ddde/attachment.html>
More information about the rrd-users
mailing list