Ad Widget

Collapse

Zabbix 1.8.2 graphs missing text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Zabbix 1.8.2 graphs missing text

    I'm finding that all my Zabbix graphs are missing axis and legend text?

    I'm not sure what Zabbix uses to render it's graphs but some other users with graphing problems posted the following excerpt from phpinfo.

    GD Support enabled
    GD Version bundled (2.0.28 compatible)
    FreeType Support enabled
    FreeType Linkage with freetype
    FreeType Version 2.2.1
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled


    I'm running on Oracle Enterprise Linux 5 (update 5) which is a RedHat EL5 clone.

    I've rebuilt the server including nearly all the optional packages in case the issue was caused by missing fonts, but the problem persists.

    Has anyone else experienced this?

    Following is an 'uptime' graph, the data looks right but no text?
    Attached Files

    #2
    Solved!

    So it looks like this is actually a pretty common problem when you can work out what the root problem is.

    Digging around, I located the call that renders text on the graphs: imagetext. imagetext is a routine (acutally called imageText - note the uppercase T - which makes it hard to find on cases sensitive searches ) that wraps imagettftext....

    more digging results in this wrapper relying on the font file path being:

    /usr/share/fonts/dejavu/DejaVuSans.ttf

    Do some creative Googling with this, and there are plenty of Zabbix font issues that point you to a fix . It seems many linux distros ship with dejavu-lgc ( which contains only Latin, Greek, Crylic - i assume to save size?) not dejavu (the complete set).

    dejavu-lgc installs to:
    /usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf

    So edit /zabbix-web-site/include/defines.inc.php and edit the following lines:

    Code:
    	define('ZBX_FONTPATH',		'/usr/share/fonts/dejavu-lgc');	// where to search for font (GD > 2.0.18)
    	define('ZBX_GRAPH_FONT_NAME',	'DejaVuLGCSans');		// font file name
    	define('ZBX_FONT_NAME', 'DejaVuLGCSans');
    restart httpd and bingo ... zabbix graphs with text!

    Thanks to the Zabbix team for a great product, it's a pleasure to use! If I could suggest a small enhancement:

    Can zabbix search the font path during the install wizard and ensure it finds an adequate ttf file?
    Last edited by nought; 15-09-2010, 01:27. Reason: more info

    Comment


      #3
      hey

      i have the same problem, missing legend and axes on zabbix graphs.
      Zabbix is running on Centos 5.4

      i've installed dejavu-lgc, and chanched path at include/defines.inc.php of zabbix web.

      But after http restart the problem didnt dissapear. Still no text at legend.
      What should i check ?

      Comment


        #4
        Further config updates

        Yo hippie,

        I don't check this forum very often so sorry I hadn't responded to you. But if you're still having this issue I'd be happy to help.

        I did notice that the fix above only did half the job, in the same file you have to also update the line:

        Code:
        define('ZBX_FONT_NAME', 'DejaVuLGCSans');
        I'll update the post above to include this.

        I'm beginning to think a 'more proper' fix might be to create a link:

        Code:
        ln /usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf
        Not sure if that's really a legit way to do things, but I think it would work. Perhaps, if an experienced linux admin is reading, they might be able to offer some advice on what they think? Edit the config -or- create a link?

        later
        Last edited by nought; 15-09-2010, 01:28.

        Comment


          #5
          I'm having the exact same problem but this wasnt enought for me.

          I've changed the font path to my fonts dir to
          /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf

          but nothing happened.

          I'm running Zabbix 1.8.2 from the Debian Squeeze package.
          (installed with a simple apt-get install)

          Any ideas?

          Comment


            #6
            Originally posted by gawry View Post
            I'm having the exact same problem but this wasnt enought for me.

            I've changed the font path to my fonts dir to
            /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf

            but nothing happened.

            I'm running Zabbix 1.8.2 from the Debian Squeeze package.
            (installed with a simple apt-get install)

            Any ideas?
            this is a same problem! ... pls help
            (Debian lenny package)
            gd

            GD Support enabled
            GD Version 2.0 or higher
            FreeType Support enabled
            FreeType Linkage with freetype
            FreeType Version 2.3.7
            T1Lib Support enabled
            GIF Read Support enabled
            GIF Create Support enabled
            JPG Support enabled
            PNG Support enabled
            WBMP Support enabled
            Last edited by szemy; 09-10-2011, 22:30.

            Comment


              #7
              I've find out that my problem was a permission problem. I couldn't see text because the application didn't have permission to access the font files.

              Maybe you should try this code and then see what is the error you get. Save this to a file, open in your browser and check the source to see the errors.

              It worked for me.

              Code:
              <?php
              // Set the content-type
              header('Content-Type: image/png');
              
              // Report all PHP errors (see changelog)
              error_reporting(E_ALL);
              
              // Create the image
              $im = imagecreatetruecolor(400, 30);
              
              // Create some colors
              $white = imagecolorallocate($im, 255, 255, 255);
              $grey = imagecolorallocate($im, 128, 128, 128);
              $black = imagecolorallocate($im, 0, 0, 0);
              imagefilledrectangle($im, 0, 0, 399, 29, $white);
              
              // The text to draw
              $text = 'Testing...';
              // Replace path by your own font path
              $font = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf'; //Change to the location of your font file
              
              // Add some shadow to the text
              imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
              
              // Add the text
              imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
              
              // Using imagepng() results in clearer text compared with imagejpeg()
              imagepng($im);
              imagedestroy($im);
              ?>

              Comment


                #8
                Hi,

                Exactly which file you changed, and this x-th row?

                advance, thank you for your help.

                Comment


                  #9
                  Change font name and ensure path is correct for your environment

                  I have DejaVu installed rather than DejaVu-lgc and I found that for me I had a slightly different font path and font name. In my case the path was '/usr/share/fonts/truetype/dejavu' and the font name did not include GC, rather it was just 'DejaVuSans'.

                  So here is what things look like in my situation:
                  define('ZBX_FONTPATH', '/usr/share/fonts/truetype/dejavu'); // where to search for font (GD > 2.0.18)
                  define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
                  define('ZBX_FONT_NAME', 'DejaVuSans');

                  Also, I am on Zabbix v 2.2, just as a heads up.

                  Enjoy!

                  Comment


                    #10
                    I have Zabbix server v2.2.4 installed on CentOS 6. Tried to change font location, but text in graphs still missing.

                    define('ZBX_FONTPATH', '/usr/share/fonts/dejavu'); // where to search for font (GD > 2.0.18)
                    define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
                    define('ZBX_FONT_NAME', 'DejaVuSans');
                    define('ZBX_GRAPH_LEGEND_HEIGHT', 120);

                    I've cheked everything, also tried to use DejaVuLGCSans font. Nothing helps, font still missing. Can anyone suggest something else?
                    Attached Files

                    Comment


                      #11
                      Hi all,

                      I have found the final fix to this problem (this was at me also on Ubuntu server):

                      1. First, install the needed font.

                      Code:
                      # apt-get install ttf-dejavu
                      2. After that make a symlink about the font into the application (frontend) "fonts" directory

                      Code:
                      # ln -s /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/DejaVuSans.ttf
                      3. Modify the "ZBX_GRAPH_FONT_NAME" variable in the defines.inc.php (/usr/share/zabbix/include/defines.inc.php) to the following:

                      Code:
                      define('ZBX_GRAPH_FONT_NAME',           'DejaVuSans'); // font file name
                      4. Restart the apache http server:

                      Code:
                      # service apache2 restart
                      Have fun, enjoy!

                      Cheers,

                      Blackcode

                      Comment


                        #12
                        Solved!

                        Hi,

                        I am using Zabbix 2.2.1/ubuntu 14.04
                        i have experienced the similar issue and this is how i fix it -

                        InstalledFont -
                        Code:
                        apt-get install ttf-dejavu
                        Found the font Location -
                        Code:
                        /usr/share/fonts/truetype/ttf-dejavu
                        where found these fonts -
                        Code:
                        DejaVuSans-BoldOblique.ttf DejaVuSans-Oblique.ttfDejaVuSans-Bold.ttf DejaVuSans.ttfDejaVuSansCondensed-BoldOblique.ttf DejaVuSerif-BoldItalic.ttfDejaVuSansCondensed-Bold.ttf DejaVuSerif-Bold.ttfDejaVuSansCondensed-Oblique.ttf DejaVuSerifCondensed-BoldItalic.ttfDejaVuSansCondensed.ttf DejaVuSerifCondensed-Bold.ttfDejaVuSans-ExtraLight.ttf DejaVuSerifCondensed-Italic.ttfDejaVuSansMono-BoldOblique.ttf DejaVuSerifCondensed.ttfDejaVuSansMono-Bold.ttf DejaVuSerif-Italic.ttfDejaVuSansMono-Oblique.ttf DejaVuSerif.ttfDejaVuSansMono.ttf
                        My web directory is - /var/www/html/zabbix

                        Edited - vim /var/www/html/zabbix/include/defines.inc.php

                        Code:
                        define('ZBX_FONTPATH', realpath('fonts'));
                        
                        TO
                        
                        define('ZBX_FONTPATH', '/usr/share/fonts/truetype/ttf-dejavu');

                        Restarted Service
                        Code:
                        service apache2 restart
                        Problem Solved.

                        Attached error screenshot.
                        Attached Files

                        Comment


                          #13
                          I had the same issue after upgrade to 4.2.2 and this thread saved my day!

                          Comment


                            #14
                            Verify permissions for '/usr/share/zabbix/assets', if not 'www-data:www:data':
                            >chown www-data:www-data assets/
                            If the file does not exist (/usr/share/zabbix/fonts/graphfont.ttf):
                            >cd assets/fonts/
                            Copy the file graphfont.ttf to /usr/share/zabbix/assets/fonts/:
                            >cp /usr/share/zabbix/fonts/graphfont.ttf /usr/share/zabbix/assets/fonts/
                            Or link the file:
                            >ln -s /usr/share/zabbix/fonts/graphfont.ttf /usr/share/zabbix/assets/fonts/
                            by, Bruno Dolastro

                            Comment


                              #15
                              I got this issue, when upgrading Zabbix 4.0 to 4.2.2 on CentOS 7 - this was the solution for me:


                              Edit
                              "/usr/share/zabbix/include/defines.inc.php" and change the following lines:


                              Code:
                              define('ZBX_FONTPATH', realpath('fonts'));
                              
                              to
                              
                              define('ZBX_FONTPATH', '/usr/share/fonts/dejavu');

                              AND

                              Code:
                              define('ZBX_GRAPH_FONT_NAME',           'graphfont'); // font file name
                              
                              TO
                              
                              define('ZBX_GRAPH_FONT_NAME',           'DejaVuSans'); // font file name


                              restart httpd service:
                              "systemctl restart httpd.service"

                              Comment

                              Announcement

                              Collapse
                              No announcement yet.
                              Working...
                              X