[rrd-users] problem calculating the difference between MAX and MIN

Yannick Marquet itcsoft54 at yahoo.fr
Fri Jun 28 00:14:04 CEST 2013


rrdtool is a tool to store normalized value, and aggregate data over 
time. To understand how rrdtool can help you, read this link :
- http://www.vandenbogaerdt.nl/rrdtool/ Section "List of tutorials and 
the like".

In your rra, you store only MAX values for each step, so data collected 
is normalized using MAX function (see 
So you can only work with MAXIMUM of MAX, AVERAGE of MAX and MINIMUM of 
MAX. Because you keep all collected step in you RRAs, using CF MAX, 
AVERAGE or MIN get same data stored.

I understand you want to display MAX value in graphed curve, MIN in 
graphed curve, AND MAX-MIN in graphed curve, independently of RRA CF 
function used to stored data.

this other thread can help you : 

A Solution can be :

rrdtool graph VSM.png --start end-24h --end now ^
--title "Aktueller Stromverbrauch" --width 600 --height 330 --alt-y-grid 
--slope-mode ^
--upper-limit 5000 --lower-limit 0 --rigid ^
--color BACK#A9F5F288 --vertical-label "Verbauch in kW" ^
DEF:Watt=VSM.rrd:Watt_cur:MAX ^
LINE1:Watt#FF0000:"Verbrauchskurve" ^
VDEF:Wact=Watt,LAST ^
DEF:kwhx=VSM.rrd:Watt_tot:MAX ^
VDEF:kwhmax=kwhx,MAXIMUM ^
VDEF:kwhmin=kwhx,MINIMUM ^
CDEF:delta=kwhx,POP,kwhmax,kwhmin,- VDEF:dd=delta,LAST ^
COMMENT:"\l" ^
COMMENT:"Verbrauch max      " GPRINT:Wmax:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch min      " GPRINT:Wmin:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch          " GPRINT:Wavg:"%%6.2lf [W]\l" ^
COMMENT:"Zaehlerstand max   " GPRINT:kwhmax:"%%6.2lf [kW]\l" ^
COMMENT:"Zaehlerstand min   " GPRINT:kwhmin:"%%6.2lf [kW]\l" ^
COMMENT:"                   " GPRINT:dd:"%%6.2lf [kW]\l" ^
COMMENT:"Verbrauch aktuell  " GPRINT:Wact:"%%6.2lf [W]\l"

Best regards,


> Hello Yannik,
> thank youz for your quick response,
> I am new to RRDTOOL
> but this is a great tool...
> this is my create command:
> rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10
> DS:Watt_cur:GAUGE:60:U:U RRA:MAX:0.5:1:60480 DS:Watt_tot:GAUGE:60:U:U
> RRA:MAX:0.5:1:60480
> you are right, I have no RRA:MIN
> Could you point me to the right create command?
> I want to store two values
> 1. the current energy  in WATT ( this is a value from 0 to maybe >10000)
> 2. the current power in kWh ( this is a value which increases each time
> period)
> I want to show power and  delta energy in the graph ( which should be about
> 10kWh / 24h)
>   I want to show a second curevewith the delta of "Zaehlerstand max" and
> "Zaehlerstand min"
> and I want to "GPRINT" this value
> do I need to recreate the database?
> --
> View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/problem-calculating-the-difference-between-MAX-and-MIN-tp7581058p7581062.html
> Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

More information about the rrd-users mailing list