Text problem in graphes [Solved]

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

Moderators: Developers, Moderators

Post Reply
e-arino
Posts: 1
Joined: Tue Apr 08, 2008 6:11 am

Text problem in graphes [Solved]

Post by e-arino »

Hello,

After a fresh install of Cacti, I could not see any text in graphes generated by rrdtool. I've searched the forum a lot about this issue and tried every solution I found but none of them solved my problem.

Here is the system I was working with :

System : Ubuntu 6.04 LTS
PHP : 5.2.5 (installed manually)
RRDtool : 1.2.11 (dpkg install)
Cacti : 0.8.7b (installed manually)

Having noticed with Graph debug turned on that the command line options passed to rrdtool for graph-generation did not include a specific font path, I decided to try the command with font paths specified.

So I ran the command using these options :

Code: Select all

--font TITLE:12:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf \
--font AXIS:8:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf \
--font LEGEND:10:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf \
--font UNIT:8:/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf \
instead of :

Code: Select all

--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
and the generated graph finally contained text.

I figured that the system environment variable RRD_DEFAULT_FONT was not set in a way that the system I was working on understood.

Cacti uses this php function to set the environment variable :

Code: Select all

putenv("RRD_DEFAULT_FONT=" . read_config_option("path_rrdtool_default_font"));
I took this line of code and tried it in a separate script, but the function never worked for me.
So I decided to specify the path explicitly in the command line arguments passed to rrdtool during graph generation.
In lib/rrd.php, function rrdtool_set_font, I replaced

Code: Select all

/* do some simple checks */
        if (!file_exists($font)) {
                $font = "";
        }
by

Code: Select all

$font = "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf";
and now, everything works fine.

Hope this helps anybody who has not found a different solution.

--
Emilien Arino
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Did you try just putting those into 'Default RRDtool 1.2 Fonts' under the 'Settings/Visual' tab?
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
TheWitness
Developer
Posts: 17059
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

That would appear to be a problem with PHP's file_exists function or with RRDtool and not having a default font set. You might want to check permissions on the font files vs. the rights of the web site user. If that does not bring joy, there is always other PHP versions.

Per Linegod, by setting the rrdtool default font in Cacti, unless you are in a jailed PHP environment should fix this issue. If you are jailed, then you must compile RRDtool with it's default font set.

Good luck.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests