Legend column alignment (cacti 0.8.7d + rrdtool 1.3.5)

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
surgpm
Posts: 4
Joined: Wed Mar 11, 2009 4:57 am

Legend column alignment (cacti 0.8.7d + rrdtool 1.3.5)

Post by surgpm »

The columns in the legend area of graphs don't line up.
It looks like the spaces or tabs aren't working correctly.
I've set the font paths in cacti to a mono spaced TTF font but it doesn't help and from what I've read rrdtool uses pango and fontlib to get a suitable font anyway.

Any ideas of how to get the columns to line up underneath each other?

Thanks
surgpm
Posts: 4
Joined: Wed Mar 11, 2009 4:57 am

Post by surgpm »

I found the problem:

Cacti 0.8.7d doesn't handle the rrdtool 1.3.5 fonts correctly.

I ran rrdtool by hand and had to change the following :

Original :
/usr/local/bin/rrdtool graph test.png \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Saix_1024 (AAPC) - Traffic - 196.25.110.238 (Serial0)" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
--slope-mode \
--font TITLE:10:/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf \
--font AXIS:6:/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf \
--font LEGEND:8:/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf \
--font UNIT:6:/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf \

DEF:a="/serv/cacti/rra/apc_saix_traffic_in_413.rrd":traffic_in:AVERAGE \
DEF:b="/serv/cacti/rra/apc_saix_traffic_in_413.rrd":traffic_out:AVERAGE \
AREA:a#00CF00FF:"Inbound" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#002A97FF:"Outbound" \
GPRINT:b:LAST:"Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s"

Fixed:
/usr/local/bin/rrdtool graph test.png \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Saix_1024 (AAPC) - Traffic - 196.25.110.238 (Serial0)" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
--slope-mode \
--font TITLE:10:DejaVuSansMono \
--font AXIS:6:DejaVuSansMono \
--font LEGEND:8:DejaVuSansMono \
--font UNIT:6:DejaVuSansMono \

DEF:a="/serv/cacti/rra/apc_saix_traffic_in_413.rrd":traffic_in:AVERAGE \
DEF:b="/serv/cacti/rra/apc_saix_traffic_in_413.rrd":traffic_out:AVERAGE \
AREA:a#00CF00FF:"Inbound" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s" \
LINE1:b#002A97FF:"Outbound" \
GPRINT:b:LAST:"Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s"

Fix 1: By specifying the font name and not the font path rrdtool can load the font via pango.
Fix 2: By removing the \n from the legend string formating the columns now line up.

Now I just have to figure out how to modify all the templates and/or existing graphs.
acasto
Posts: 38
Joined: Tue Mar 03, 2009 9:00 am

Post by acasto »

Just for other's sake for future reference, sometimes the auto-padding option can cause issues with column alignment.


Adam
Moriarty
Posts: 23
Joined: Thu Apr 12, 2007 10:18 am

Post by Moriarty »

Is there any chance of a patch diff for this, or will it wait until the next release?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

At least a bug report is required: http://www.cacti.net/bugs.php
All settings are required, e.g. font path settings in cacti
Reinhard
Z.Beeblebrox
Posts: 5
Joined: Fri May 08, 2009 1:20 pm

Post by Z.Beeblebrox »

Temporary solution (little bit evil):
  1. Set "DejaVuSansMono" as legend font file in cacti settings.
  2. Create an empty file named "DejaVuSansMono" in cacti/site directory.
This forces rrdtool to load the font via pango and it ships around the font file check. ;)
Attachments
This workaround in action.
This workaround in action.
vm-admin-2009-05-08-20-35-50.png (75.57 KiB) Viewed 5250 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

According to http://www.mail-archive.com/rrd-announc ... 00118.html this should have been fixed since rrdtool 1.3.5 as a rrdtool bug
Unfortunately, I can't verify yet.
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests