Default font

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
CirruZZ
Posts: 4
Joined: Sat Oct 24, 2009 9:27 am
Location: Sweden

Default font

Post by CirruZZ »

Hi! I'm rather new to cacti but have done some graphing with perl/bash and rrdtool before.

What I cant understand is how to get the right font for the graphs in cacti.

Some examples.

I have e test graph in cacti.

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="fw.local - CPU Utilization - CPU0" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="percent" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:AVERAGE \
DEF:b="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:MAX \
AREA:a#FF0000FF:"CPU Utilization"  \
GPRINT:a:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:b:MAX:"Maximum\:%8.0lf\n"  \
COMMENT:"12345678901234567890\n"  \
COMMENT:"ABCDEFGHIJKLMNOPQRST\n"  \
COMMENT:"abcdefghijklmnopqrst\n" 
Image


And then the same graph made in a perl script.

Code: Select all

RRDs::graph "/var/www/_graphs/cacti_font.png",	
			"--imgformat=PNG",
			"--start=1256296886",
			"--end=1256383286",
			"--title=fw.local - CPU Utilization - CPU0",
			"--rigid",
			"--base=1000",
			"--height=120",
			"--width=500",
			"--alt-autoscale-max",
			"--lower-limit=0",
			"COMMENT:Test\\n",
			"COMMENT:\\n",
			"--vertical-label=percent",
			"--slope-mode",
			"--font=TITLE:12",
			"--font=AXIS:8",
			"--font=LEGEND:8",
			"--font=UNIT:8",
			"DEF:a=/var/lib/cacti /rra/fw_local_cpu_16.rrd:cpu:AVERAGE",
			"DEF:b=/var/lib/cacti/rra/fw_local_cpu_16.rrd:cpu:MAX",
			"AREA:a#FF0000FF: CPU Utilization",
			"GPRINT:a:LAST:Current\\:%8.0lf",
			"GPRINT:a:AVERAGE:Average\\:%8.0lf",
			"GPRINT:b:MAX:Maximum\\:%8.0lf\\n",
			"COMMENT:12345678901234567890\\n",
			"COMMENT:ABCDEFGHIJKLMNOPQRST\\n",
			"COMMENT:abcdefghijklmnopqrst\\n";
Image

What I want is for cacti to use the same font as of what rrdtool in perl does. With that font i get all the characters to line up underneath each other and so have easier to outline text, (se the second example above). I have tried to specify different fonts for cacti but with no result.

And I haven't been able to figure out what the font type is for the second graph (the graph done with perl). Anyone that know what font rrdtool uses natively in Ubuntu?

I use...
Ubuntu 8.10
Cacti 0.8.7b (apt-get)
rrdtool 1.3.1

Tanx in advance!
Attachments
graph from cacti
graph from cacti
cacti.png (24.36 KiB) Viewed 9633 times
graph from perl
graph from perl
cacti_font.png (27.12 KiB) Viewed 9633 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

There are many font settings. Global settings are at "Settings -> Paths" and "Settings -> Visual". User specific Settings are seen when using the graph view page, Settings tab.
R.
CirruZZ
Posts: 4
Joined: Sat Oct 24, 2009 9:27 am
Location: Sweden

Post by CirruZZ »

Gandalf, thanks for answering.

I do think i have fiddled around with every settings I could find. The problem is that i don't know what font to specify to get the same result (font) i Cacti as I get when just using perl script (or bash).

And i doesn't have to be the exact same, I just want a fixed width font i Cacti.
dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

You need a fixed width font - not sure how you tell which ones are fixed in your OS. Courier is almost always fixed (unless it is called Courier proportional).

If you have Gnome or KDE on your Ubuntu box, you should be able to find a fixed width font by creating some text in an editor then switching the font until you find one that suits you. Probably easier to do that than identify the font in your screen shots, although someone might have a better eye than me.
CirruZZ
Posts: 4
Joined: Sat Oct 24, 2009 9:27 am
Location: Sweden

Post by CirruZZ »

Yah, I have figured out that i need a fixed with font. The problem is that I'm on a server installation and I have tried some of the fonts that I can find on the system, but none of them seems to be "fixed with".

Code: Select all

anders@Srv:/$ locate *.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-ExtraLight.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-BoldOblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Oblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Bold.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-BoldItalic.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-Italic.ttf
/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed.ttf
/usr/share/rrdtool/librrd2/DejaVuSansMono-Roman.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSans-Bold.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSans-BoldOblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSans-ExtraLight.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSans-Oblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSans.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansCondensed-Bold.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansCondensed-BoldOblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansCondensed-Oblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansCondensed.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansMono-Bold.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansMono-BoldOblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansMono-Oblique.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSansMono.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerif-Bold.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerif-BoldItalic.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerif-Italic.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerif.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerifCondensed-Bold.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerifCondensed-BoldItalic.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerifCondensed-Italic.ttf
/var/lib/defoma/gs.d/dirs/fonts/DejaVuSerifCondensed.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSans-Bold.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSans-BoldOblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSans-ExtraLight.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSans-Oblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSans.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansCondensed-Bold.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansCondensed-BoldOblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansCondensed-Oblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansCondensed.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansMono-Bold.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansMono-BoldOblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansMono-Oblique.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansMono.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif-Bold.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif-BoldItalic.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif-Italic.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerifCondensed-Bold.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerifCondensed-BoldItalic.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerifCondensed-Italic.ttf
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerifCondensed.ttf

A wondering that I have is why Cacti uses a different (default) font when drawing the graphs then when the graphs is being drawn from Perl. At least what i can see by the specifications (of the graphs above) it shouldn't be any difference. :-?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

DejaVuMono should do.
R.
CirruZZ
Posts: 4
Joined: Sat Oct 24, 2009 9:27 am
Location: Sweden

Post by CirruZZ »

Test with DejaVuSansMono-Roman.ttf

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="fw.local - CPU Utilization - CPU0" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="percent" \
--slope-mode \
--font TITLE:12:/usr/share/rrdtool/librrd2/DejaVuSansMono-Roman.ttf \
--font AXIS:8:/usr/share/rrdtool/librrd2/DejaVuSansMono-Roman.ttf \
--font LEGEND:8:/usr/share/rrdtool/librrd2/DejaVuSansMono-Roman.ttf \
--font UNIT:8:/usr/share/rrdtool/librrd2/DejaVuSansMono-Roman.ttf \
DEF:a="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:AVERAGE \
DEF:b="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:MAX \
AREA:a#FF0000FF:"CPU Utilization"  \
GPRINT:a:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:b:MAX:"Maximum\:%8.0lf\n"  \
COMMENT:"12345678901234567890\n"  \
COMMENT:"ABCDEFGHIJKLMNOPQRST\n"  \
COMMENT:"abcdefghijklmnopqrst\n" 
Image

Test with DejaVuSansMono.ttf

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="fw.local - CPU Utilization - CPU0" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="percent" \
--slope-mode \
--font TITLE:12:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf \
--font AXIS:8:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf \
--font LEGEND:8:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf \
--font UNIT:8:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf \
DEF:a="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:AVERAGE \
DEF:b="/var/lib/cacti/rra/fw_local_cpu_16.rrd":cpu:MAX \
AREA:a#FF0000FF:"CPU Utilization"  \
GPRINT:a:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:b:MAX:"Maximum\:%8.0lf\n"  \
COMMENT:"12345678901234567890\n"  \
COMMENT:"ABCDEFGHIJKLMNOPQRST\n"  \
COMMENT:"abcdefghijklmnopqrst\n" 
Image

Doesn't seem to do any difference... :cry:
Attachments
font2.png
font2.png (41.8 KiB) Viewed 9552 times
font3.png
font3.png (41.9 KiB) Viewed 9552 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This is the wrong syntax for rrdtool 1.3.x (and yes, this is a known bug with cacti). You will have to define the font name, not the font FILE name as required with older rrdtool versions.
Unfortunately, cacti will throw a "file not found" error, because it will try to find the corresponding file (which obviously does not exist). You may ignore that error.
R.
User avatar
classen
Cacti User
Posts: 116
Joined: Thu Nov 12, 2009 3:07 pm

Post by classen »

bump.

I'm having similar problems finding a true fixed width font for displaying nice graphs in cacti with rrd

My webserver/cacti installation is on a Fedors 8 machine.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm sorry, but that's a font file question. Depending on your distro, files are stored at different places.
When using rrdtool 1.3, the command fc-list may tell you the font names that are required
R.
disH
Posts: 33
Joined: Thu May 22, 2008 2:09 am

Post by disH »

gandalf wrote:This is the wrong syntax for rrdtool 1.3.x (and yes, this is a known bug with cacti). You will have to define the font name, not the font FILE name as required with older rrdtool versions.
Unfortunately, cacti will throw a "file not found" error, because it will try to find the corresponding file (which obviously does not exist). You may ignore that error.
R.
thanks i was fiddling with that today as well.
ill try again without the path
[url=http://forums.cacti.net/viewtopic.php?t=4356]Template: Cisco CatOS[/url]
[url=http://forums.cacti.net/viewtopic.php?t=21785]Mactrack: Netscreen Fw[/url]
[b]_______________[/b]
[b]Cacti Version[/b] - 0.8.7e, [b]Plugin Architecture[/b] - 2.5, [b]Poller Type[/b] - Cact-Spine 0.8.7e
[b]Server Info[/b] - Ubuntu Server 8.10 (2.6.27-7-server), [b]Web Server[/b] - Apache/2.2.9 PHP/5.2.6-2ubuntu4.3 with Suhosin-Patch
[b]PHP[/b] - 5.2.6-2ubuntu4.3, [b]MySQL[/b] - 5.0.67-0ubuntu6-log, [b]RRDTool[/b] - 1.3.1, [b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Thresholds v0.4.1, Login Mod v1.0, Host Info v0.2
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests