[ZBX-12690] Zabbix 3.4 not showing legend Created: 2017 Sep 07  Updated: 2022 Apr 13  Resolved: 2017 Oct 18

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I), Packages (C)
Affects Version/s: 3.4.0
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Renat Shaimardanov Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian Stretch, Nginx, PHP7


Attachments: PNG File graph_settings.png     PNG File graph_without_legend_set_on.png     PNG File legend.png     PNG File zabbix-no-legends-3_4_2.PNG    
Issue Links:
Duplicate
is duplicated by ZBX-15321 Values and references on graphs Closed
Team: Team A
Sprint: Sprint 19
Story Points: 0.2

 Description   

Zabbix 3.4 not showing legend.
After adding font graphfont.ttf in /usr/share/zabbix/fonts problem fix



 Comments   
Comment by Renat Shaimardanov [ 2017 Sep 08 ]

Find the problem
In package post install script
if [ -e /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf ]; then
update-alternatives --install /usr/share/zabbix/fonts/graphfont.ttf zabbix-frontend-font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf 10
fi

but in Debian stretch
font path is following
/usr/share/fonts/truetype/dejavu

Comment by Tyron [ 2017 Oct 13 ]

+1
Thanks Renat, that solved my issue. Ubuntu 16.04 has the same path (/usr/share/fonts/truetype/dejavu), not "ttf-dejavu".

Comment by Renat Shaimardanov [ 2017 Oct 16 ]

You are welcome.

Comment by Imre Mamedov [ 2017 Oct 17 ]

Huge Thanks Renat, that solved my issue as well. (Debian Stretch)

Comment by dimir [ 2017 Oct 17 ]

Thank you for the report! It will be fixed in 3.4.3 .

Comment by dimir [ 2017 Oct 18 ]

Fixed in 3.4.3-2

Comment by Charl Viljoen [ 2017 Oct 19 ]

I updated to 3.4.3-2 and my graphs are still not displaying correctly. Also same setup. Ubuntu 16.04, MySQL, NGINX. Anyone still have the same issue?

Comment by dimir [ 2017 Oct 19 ]

Try restarting web server/clearing the browser cache. Another thing you might want to try is dpkg-reconfigure zabbix-frontend-php.

If the problem is still there, could you show the output of the following command:

$ ls -l /usr/share/zabbix/fonts/graphfont.ttf /etc/alternatives/zabbix-frontend-font
Comment by Charl Viljoen [ 2017 Oct 19 ]

No output.
`
root@zabbix:~# dpkg-reconfigure zabbix-frontend-php
root@zabbix:~#
`

Config below:
`
root@zabbix:~# ls -l /usr/share/zabbix/fonts/graphfont.ttf /etc/alternatives/zabbix-frontend-font
lrwxrwxrwx 1 root root 47 Oct 18 17:25 /etc/alternatives/zabbix-frontend-font -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
lrwxrwxrwx 1 www-data www-data 38 Oct 18 17:25 /usr/share/zabbix/fonts/graphfont.ttf -> /etc/alternatives/zabbix-frontend-font
`

Comment by dimir [ 2017 Oct 19 ]

You have everything in place. I guess you just need to restart the web server or something.

Comment by Charl Viljoen [ 2017 Oct 19 ]

Just rebooted the whole Zabbix Server. The graphs still display with no legend.

Comment by dimir [ 2017 Oct 19 ]

Zabbix server has nothing to do with that. It's the web server.

But could you show the screenshot of the graph without legend? Could it be that your graph has "Show legend" box unchecked?

oleg.egorov Graph edit form

Comment by Charl Viljoen [ 2017 Oct 19 ]

See my screenshot attached. The settings are enabled. I have check a couple of other ones too.

Comment by Charl Viljoen [ 2017 Oct 19 ]

See the new screenshot.

Comment by Tyron [ 2017 Oct 19 ]

no legends on 3.4.2

Comment by Tyron [ 2017 Oct 19 ]

charlviljoen I believe you have something else. On my 3.4.2, this ticket is regarding the text not being displayed, but you can clearly view the "squares" with the appropriate colors.

Comment by Charl Viljoen [ 2017 Oct 19 ]

Why would the Text not display? The settings are all correct. :|

Comment by Vjaceslavs Bogdanovs [ 2017 Oct 20 ]

Looks like the font is missing. (c) Captain obvious

Please check the following:

  1. Execute php -r "echo realpath('fonts');" in the web root of Zabbix frontend to get the path to font directory.
  2. Check if font directory contains DejaVuSans.ttf
  3. Check if this file is accessible by web server.
  4. As an additional sanity check, you can if file DejaVuSans.ttf is a valid ttf file.
Comment by Charl Viljoen [ 2017 Oct 20 ]

I have excecuted ->

php -r "echo realpath('fonts');"

The fonts is located under

<web-root>/fonts

When I

ls

that

DIR

I get the following. Checked and the files exist.

lrwxrwxrwx  1 www-data www-data   47 Oct 20 10:54 DejaVuSans.ttf -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
lrwxrwxrwx  1 www-data www-data   38 Oct 18 17:25 graphfont.ttf -> /etc/alternatives/zabbix-frontend-font
Comment by Charl Viljoen [ 2017 Oct 20 ]

I fixed it by copying the font file to the fonts root.

Thanks for all your help guys

Comment by dimir [ 2017 Oct 20 ]

Thanks, vjaceslavs!

Comment by Alou Ala [ 2018 Jul 24 ]

Excuse me n0mad. I have the same issue but I didn't understand your way of doing. May you be more explicit about the way you solve the issue please? where does this script go?

Comment by Renat Shaimardanov [ 2018 Jul 25 ]

Alou - try to run the following command

update-alternatives --install /usr/share/zabbix/fonts/graphfont.ttf zabbix-frontend-font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf 10

Its work for me

Comment by Alou Ala [ 2018 Jul 25 ]

big thanks n0mad I solved it

Comment by Dmitry [ 2019 Jun 10 ]

Hello!

Zabbix 4.2.2. 
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"

The fix

$grep 'FONTPATH' /usr/share/zabbix/include/defines.inc.php
define('ZBX_FONTPATH',                          realpath('assets/fonts')); // where to search for font (GD > 2.0.18)
$ls -alh /usr/share/zabbix/assets/fonts/
empty (no files) - here is the problem
$cp -vf /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf /usr/share/zabbix/assets/fonts/DejaVuSans.ttf
$cp -vf /etc/alternatives/zabbix-frontend-font /usr/share/zabbix/assets/fonts/graphfont.ttf
$service zabbix-server restart && service apache2 restart

Comment by Ivan Kalenyuk [ 2022 Apr 13 ]

Такая же проблема с легендой графиков.

Zabbix 5.0.21

Fedora Server 34

Решил проблему так . Скопировал DejaVuSans.ttf

из /usr/share/fonts/dejavu-sans-fonts/DejaVuSans.ttf
 в папку /usr/share/zabbix/assets/fonts/ 

и переименовал в graphfont.ttf.

Generated at Thu Mar 28 23:26:44 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.