Zabbix 如何解决字体显示异常问题

Zabbix监控页面中文显示异常,具体为显示为方块,如图所示。php

中文监控选项乱码

首先查找zabbix安装目录,找到字体具体位置。web

#查找zabbix安装位置
[root@promote ~]# whereis zabbix
zabbix: /usr/lib/zabbix /etc/zabbix /usr/share/zabbix
[root@promote ~]# ls /usr/share/zabbix/
actionconf.php                 app                 charts.php                   hostinventories.php  items.php        report2.php        styles
adm.gui.php                    applications.php    conf                         host_prototypes.php  js               report4.php        sysmap.php
adm.housekeeper.php            audio               conf.import.php              host_screen.php      jsLoader.php     robots.txt         sysmaps.php
adm.iconmapping.php            auditacts.php       correlation.php              hosts.php            jsrpc.php        screenconf.php     templates.php
adm.images.php                 auditlogs.php       discoveryconf.php            httpconf.php         latest.php       screenedit.php     toptriggers.php
adm.macros.php                 browserwarning.php  disc_prototypes.php          httpdetails.php      local            screen.import.php  tr_events.php
adm.other.php                  chart2.php          favicon.ico                  image.php            locale           screens.php        trigger_prototypes.php
adm.regexps.php                chart3.php          fonts                        images               maintenance.php  search.php         triggers.php
adm.triggerdisplayoptions.php  chart4.php          graphs.php                   img                  map.import.php   services.php       usergrps.php
adm.triggerseverities.php      chart5.php          history.php                  imgstore.php         map.php          setup.php          users.php
adm.valuemapping.php           chart6.php          host_discovery.php           include              overview.php     slideconf.php      zabbix.php
adm.workingtime.php            chart7.php          hostgroups.php               index_http.php       profile.php      slides.php
api_jsonrpc.php                chart.php           hostinventoriesoverview.php  index.php            queue.php        srv_status.php
#字体文件位置
[root@promote ~]# ls /usr/share/zabbix/fonts/
graphfont.ttf
[root@promote ~]# cd /usr/share/zabbix/fonts/
[root@promote fonts]# pwd
/usr/share/zabbix/fonts
[root@promote fonts]# ls -l
总用量 0
lrwxrwxrwx. 1 root root 33 3月  25 15:24 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@promote fonts]#

采用winscp等工具将Windows中文字体上传到 /usr/share/zabbix/fonts/ 文件夹。本文中文字体为宋体。字体权限修改后截图以下所示:json

上传字体文件

切换至/etc/alternatives 目录查看软连接。api

字体软链接

删除旧软连接并新建。也能够修改成其余中文字体,例如仿宋或者微软雅黑。浏览器

#删除旧软连接
[root@promote fonts]# rm -f /etc/alternatives/zabbix-web-font
#新建软连接
[root@promote fonts]# ln -s /usr/share/zabbix/fonts/simsun.ttc  /etc/alternatives/zabbix-web-font

刷新(Ctrl+F5)浏览器页面便可,若是显示异常,请从新启动zabbix-server服务。app

[root@promote fonts]# systemctl restart zabbix-server

正常显示字体如图所示。ide

中文字体显示正常