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

Daniele Sluijters d.sluijters at betterbe.com
Tue Jul 19 10:37:16 CEST 2011

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",
        "GPRINT:inbits:AVERAGE:%6.2lf %Sbps     ",
        "GPRINT:inbits:MAX:%6.2lf %Sbps\\l",
        "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,

Daniele Sluijters
e: d.sluijters at betterbe.com
w: http://www.betterbe.com

More information about the rrd-users mailing list