Zabbix监控页面中文显示异常,具体为显示为方块,如图所示。
首先查找zabbix安装目录,找到字体具体位置。
#查找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/ 文件夹。本文中文字体为宋体。字体权限修改后截图如下所示:
切换至/etc/alternatives 目录查看软链接。
删除旧软链接并新建。也可以修改为其他中文字体,例如仿宋或者微软雅黑。
#删除旧软链接
[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服务。
[root@promote fonts]# systemctl restart zabbix-server
正常显示字体如图所示。