# [rrd-users] Stacking at Infinity

Chris Mason chris at noodles.org.uk
Sun Mar 4 22:12:26 CET 2012

```Hi Martin,

Thank you for taking your time to respond.

To ensure I understand this correctly, this will print a TICK on the
graph for each DS. It will either be RED or GREEN depending
on the value of the DS?

The problem I have is I am graphing classes for QoS with a different
number of classes per graph. I would prefer it to only show TICKs if I
have drops within that class and I would like the TICK to be the same
colour as the Octets for that class.

E.g:

Class1Drops = 0
Class2Drops = 100
Class3Drops = 0
Class4Drops = 57

I have also defined ClassXOctets for each respective class which is
coloured according to an algorithm. If I detect drops in any of the
classes then I draw the background red using INF/NEGINF. However, to
identify the specific classes I wanted to draw a TICK using the colour
of that class.

The above scenario would result in 3 TICKs being printed on the graph
using the respective colour of that class. I suppose it would be nice
to have TICK stacking where I could append '::STACK' to the end of
sequential TICKs.

In the event of using a CDEF for the fraction value I am still
struggling to work out how to achieve the desired result because I
would have to start with the highest fraction value. I am not sure if
the following would work:

CDEF:BASE1=0,-0.1,+
CDEF:C1F=Class1Drops,0,GT,BASE1,0,IF

CDEF:BASE2=Class1Drops,0,GT,BASE1,-0.01,+,BASE1,IF
CDEF:C2F=Class2Drops,0,GT,BASE2,0,IF

CDEF:BASE3=Class2Drops,0,GT,BASE2,-0.01,+,BASE2,IF
CDEF:C3F=Class3Drops,0,GT,BASE3,0,IF

CDEF:BASE4=Class3Drops,0,GT,BASE3,-0.01,+,BASE3,IF
CDEF:C4F=Class4Drops,0,GT,BASE4,0,IF

TICK:Class4Drops#AAAAA:C4F
TICK:Class3Drops#BBBBB:C3F
TICK:Class2Drops#CCCCC:C2F
TICK:Class1Drops#DDDDD:C1F

Thanks,
Chris

On 4 March 2012 12:52, Martin Sperl <rrdtool at martin.sperl.org> wrote:
> OK, so assuming those 3:
> Here a "Red/green" colorcoding you could also use:
> CDEF:DS1GREEN=DS1,UN,0,1,IF
> CDEF:DS1RED=DS1,UN,1,0,IF
> CDEF:DS2GREEN=DS2,UN,0,1,IF
> CDEF:DS2RED=DS2,UN,1,0,IF
> CDEF:DS3GREEN=DS3,UN,0,1,IF
> CDEF:DS3RED=DS3,UN,1,0,IF
> TICK:DS1GREEN#00ff00:-.03
> TICK:DS1RED#ff0000:-.03
> TICK:DS2GREEN#00ff00:-.02
> TICK:DS2RED#ff0000:-.02
> TICK:DS3GREEN#00ff00:-.01
> TICK:DS3RED#ff0000:-.01
> # here graph the other stuff (on top of the ticks!)
>
> Then you would get 3 stripes that are green/red in the relevant sections of the DS being undefined
>
> If you want even "bars" separating those 3 sections:
> add the following:
> CDEF:bar=1
>        TICK:DS1GREEN#00ff00:-.03
>        TICK:DS1RED#ff0000:-.03
> TICK:bar#000000:-0.21
>        TICK:DS2GREEN#00ff00:-.02
>        TICK:DS2RED#ff0000:-.02
> TICK:bar#000000:-0.11
>        TICK:DS3GREEN#00ff00:-.01
>        TICK:DS3RED#ff0000:-.01
>
> that should show bars all the length of the graph with green/red in between
>
> I also have sent a patch to Tobi to allow TICK to use the values of the DEF/CDEF itself as the fraction - so this could mean a non-constant fraction...
> This may also be helpful in some usecases to present data...
>
> Ciao,
>        Martin
>
> On 03.03.2012, at 13:44, Chris Mason wrote:
>
>> Hi,
>>
>>> One line at the top (or bottom) of the graph, then stack a suffient amount
>>> in the "wrong" direction. I never tried it, but stacking -50M "on top" of
>>> 150M should get you at 100M.
>>
>> So this works normally when not working at infinity:
>>
>> LINE3:1000000#FF0000
>> LINE3:-10000#00FF00::STACK
>>
>> I assumed the LINE would take into consideration the lines width when
>> stacking so I could use -1 as the value. This doesn't seem to work and
>> I have to use an actual value but this value would be dependant on the
>> scale of the data.
>>
>> However, when I draw the first line at INF then it doesn't seem to
>> work and have looked into the possibility of achieving the desired
>> affect using TICKs as suggested by Martin:
>>
>>> I remember that I have done so to highlight times when we have exceeded predictions.
>>> You could obviously paint multiple TICKS for different types and paint them with different colors using transparency.
>>> As the color (de)coding may be a pain you possibly could draw multiple ticks of different fractions.
>>
>> This looks promising and I have used the following to get my desired affect:
>>
>> AREA:ifOutDropsH#FF000055
>> TICK:DS3#0000FF:-0.03
>> TICK:DS2#FF0000:-0.02
>> TICK:DS1#00FF00:-0.01
>>
>> ** ifOutDrops is INF or NEGINF if drops detected.
>>
>> This is so close to what I want to achieve, where each TICK is 1% of
>> the Y axis. To get a stacking affect I am overlapping TICKs with the
>> bottom one being slightly taller than the next one.
>>
>> Now, this works if all classes have drops in, but in most cases they
>> don't and it is only a single class which has drops. If it was DS3 and
>> DS1 then the DS3 TICK would be visibly 2% tall as opposed to 1%.
>>
>> Is it possible to calculate the fraction dynamically depending if I
>> have drops in the classes or is there an alternative approach?
>>
>> Thanks,
>> Chris
>

```

More information about the rrd-users mailing list