[rrd-users] legend: getting everything aligned and perky

Brandon Phelps bphelps at gls.com
Tue Jul 19 14:55:21 CEST 2011


I use the following, which seems to be the same as your output, minus 
the header line:

AREA:rhigh#FF6666AA:"High  " \
LINE1:rhigh#FF0000 \
GPRINT:rhigh:AVERAGE:"Avg\\: %7.2lf" \
GPRINT:rhigh:MAX:"Max\\: %4.0lf\\n" \
AREA:rmedium#6666FFAA:"Medium" \
LINE1:rmedium#0000FF \
GPRINT:rmedium:AVERAGE:"Avg\\: %7.2lf" \
GPRINT:rmedium:MAX:"Max\\: %4.0lf\\n" \

The environment I'm using requires me to escape colons, so you might not 
need those extra \\'s before the colons.  The important thing to 
remember is to include your format string in quotes, so that you can 
manually add extra space where necessary.  For example if you wanted to 
spell out the word "Average" instead of "Avg", you would need to change 
the "Max:" to be "Max    :" instead, etc.

Good luck!

On 07/19/2011 04:37 AM, Daniele Sluijters wrote:
> Hi guys,
>
> Probably a semi-dreaded topic here but does anyone have a good idea as to how to make the legend align?
> Tools like munin seem to have a pretty good grasp of it but whatever I try I always end up with one value or another out of place.
>
> Currently I'm looking to create a structure like this
>
>               | Heading 1                | Heading 2
> line1     Value1.1                       Value1.2
> line2     Value2.1                       Value2.2
> area1   Value3.1                       Value3.2
> area2   Value4.1                       Value4.2
>
> Now whichever way I try to swing this I always end up with uneven spacings between value1.1 and value 1.2 compared to value2.1 to 2.2 because the value outputted for 2.1 has an extra zero or something like that screwing up the spacing. Or if the name of area2 has more characters everything else gets bumped.
>
> To give you an idea:
>          "COMMENT:              Average",
>          "COMMENT:        Max\\n",
>          "AREA:tierin#014194:Incoming:STACK",
>          "GPRINT:inbits:AVERAGE:%6.2lf %Sbps     ",
>          "GPRINT:inbits:MAX:%6.2lf %Sbps\\l",
>          "AREA:tierout#014194:Outgoing:STACK",
>          "GPRINT:outbits:AVERAGE:%6.2lf %Sbps     ",
>          "GPRINT:outbits:MAX:%6.2lf %Sbps\\l",
>
> That works, ish, for interface-related graphs but screws up because of the usage of spaces and other stuff to align everything. The fact that Incoming and Outgoing use, character-wise, the same amount of space is the only thing that saves me.
>
> I've tried a few things with the GPRINT statement and COMMENT and though I can get it to work for a few specific graphs I haven't found a universal way of achieving this. Is there an "easy" way to do this, did someone happen to write a tool for it or can I use something like the html<table>-tag?
>
> Kind regards,
>



More information about the rrd-users mailing list