"Zabbix"-Chinese font "garbled" (no Chinese font) @20210228

Problem Description

In Graph, Chinese fonts cannot be displayed (the font becomes "square" or not displayed at all), as shown in the following figure:
pasted_image002.png

problem causes

This is not "garbled", but a missing font. In Zabbix, pictures are used to present chart data, and the corresponding font files need to be found when rendering fonts on pictures. If the font is not configured correctly (the font does not support Chinese or the font cannot be found), the font cannot be rendered in the picture, and squares will be displayed or this is completely blank.

solution

Search for the ttf keyword in the code, and then gradually track down the font loading path.

Debian and Zabbix ???

#!/bin/sh 

# Install fonts containing Chinese fonts 
apt-get install fonts-wqy-microhei 

# update alternative zabbix -frontend-font 
update-alternatives --install /usr/share/zabbix/fonts/graphfont.ttf \ 
    zabbix -frontend-font /usr/share/fonts/truetype/wqy/wqy-microhei.ttc 10 

# Configure to use wqy-microhei.ttc font 
update-alternatives --config zabbix -frontend-font

CentOS and Zabbix

Applicable to CentOS 6.9, CentOS 7.x release version:

#!/bin/sh 

# You can also use your favorite fonts, whatever you want, you need Chinese fonts 
yum install -y wqy-microhei-fonts.noarch 

# CentOS release 6.9 (Final) and Zabbix 4.2 
update-alternatives --install /usr/share/zabbix/assets/fonts/graphfont.ttf \ 
    zabbix-web-font /usr/share/fonts/wqy-microhei/wqy-microhei.ttc 10 

# CentOS Linux release 7.5.1804 (Core) and Zabbix 4.0 .1 
update-alternatives --install /usr/share/zabbix/assets/fonts/graphfont.ttf \ 
    zabbix-web-font /usr/share/fonts/wqy-microhei/wqy-microhei.ttc 10 

# Configure font selection 
update -alternatives --config zabbix-web-font

Attachment description

Actually operating this wave is to modify the location pointed to by /usr/share/zabbix/fonts/graphfont.ttf .

related articles

"Zabbix"-set active mode and passive mode
"Zabbix"-items (Items)

references

Modify zabbix to Chinese and solve the garbled problem (3)
How to add a program to update-alternatives

Guess you like

Origin blog.csdn.net/u013670453/article/details/114238462