[rrd-users] STACK confusion

Simon Hobson linux at thehobsons.co.uk
Sat Jul 9 10:35:53 CEST 2011

Rick Dicaire wrote:

>Hi folks, is '0' considered unknown when stacking?

No - but bear in mind that anything stacked on top of unknown is also 
considered unknown for drawing purposes.

>I have 5 DS's, and I'm trying to stack them, most of the time each DS
>value is 0.00:
>rrdtool lastupdate /var/db/rrd/hdd_tput.rrd
>  ada0 ada1 ada2 ada3 ad4
>1310189105: 0.00 0.00 0.00 0.00 0.00
>When graphing, I use this order: ad4 ada0 ada1 ada2 ada3
>I STACK ada0 ada1 ada2 ada3.
>If ad4 has a non-zero value, its correct value is graphed, using the
>color configured for ada3.
>Here are the definitions:
>                 "DEF:pre_ad4=$rrd:ad4:AVERAGE:step=300",
>                 "CDEF:ad4=pre_ad4,1000000,*",
>                 "LINE2:ad4#FF00FF:ad4",
>                 "GPRINT:ad4:LAST:%4.0lf %s\\t",
>                 "DEF:pre_ada0=$rrd:ada0:AVERAGE:step=300",
>                 "CDEF:ada0=pre_ada0,1000000,*",
>                 "LINE2:ada0#e10000:ada0:STACK",
>                 "GPRINT:ada0:LAST:%4.0lf %s\\t",
>                 "DEF:pre_ada1=$rrd:ada1:AVERAGE:step=300",
>                 "CDEF:ada1=pre_ada1,1000000,*",
>                 "LINE2:ada1#e1e100:ada1:STACK",
>                 "GPRINT:ada1:LAST:%4.0lf %s\\t",
>                 "DEF:pre_ada2=$rrd:ada2:AVERAGE:step=300",
>                 "CDEF:ada2=pre_ada2,1000000,*",
>                 "LINE2:ada2#00e100:ada2:STACK",
>                 "GPRINT:ada2:LAST:%4.0lf %s\\t",
>                 "DEF:pre_ada3=$rrd:ada3:AVERAGE:step=300",
>                 "CDEF:ada3=pre_ada3,1000000,*",
>                 "LINE2:ada3#0000e1:ada3:STACK",
>                 "GPRINT:ada3:LAST:%4.0lf %s\\l"
>Example can be seen here http://www.ardynet.com/~ardy/ad4.png
>How can I stack each DS?

You have ;-)

Yes, it took me a few moments to work out what's happened here, but 
prepare for that "Doh" moment.

You draw a line at the value of ad4, then you stack on top of it a 
line for ada0, then ada1 ... ada3. ada0 - ada3 are zero, so where do 
those lines get drawn ? Yes, right in the exact same pixels as the 
line you drew for ad4.

So you've drawn a pink line, then overdrawn it with red, yellow, 
green, and finally blue lines - so all you see is the last one drawn, 

If you change line to area I think you'll find it works out.
Alternatively you could try experimenting with transparency (the 4th 
octet in the colour definition, eg 0000FF7F would draw a half 
transparent blue line) or dashes.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list