我們先需要在windows系統下的C:\Windows\Fonts目錄,找到一個喜歡的字體,我選擇的是微軟雅黑。復制到其它路徑下,選取一個msyh.ttc。到服務器上。要把msyh.ttc改為msyh.ttf才可以。不然最后中英文都不顯示
[root@hadoop105.yinzhengjie.com ~]# find / -name defines.inc.php
/usr/share/zabbix/include/defines.inc.php
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# grep -i graphfont /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file name
define('ZBX_FONT_NAME', 'graphfont');
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# find /usr/share/zabbix/ -name graphfont* # 我們可以先查看一下字體文件在哪個路徑,而后看看是否還有其它字體。
/usr/share/zabbix/assets/fonts/graphfont.ttf
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# ll /usr/share/zabbix/assets/fonts
total 0
lrwxrwxrwx 1 root root 33 Nov 4 16:24 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# ll
total 11512
-rw-r--r-- 1 root root 11787328 Mar 2 2019 simkai.ttf
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# mv simkai.ttf /usr/share/zabbix/assets/fonts
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# ll /usr/share/zabbix/assets/fonts # 注意觀察,字體的名稱后綴是否一致,若不一致則不要繼續做后面的操作,否則可能會導致zabbix web界面的英文文字也不正常顯示了。
total 11512
lrwxrwxrwx 1 root root 33 Nov 4 16:24 graphfont.ttf -> /etc/alternatives/zabbix-web-font
-rw-r--r-- 1 root root 11787328 Mar 2 2019 simkai.ttf
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# cp /usr/share/zabbix/include/defines.inc.php /usr/share/zabbix/include/defines.inc.php-`date +%F` # 修改前一定要做好被備份喲~
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# sed -r -i 's#graphfont#simkai#' /usr/share/zabbix/include/defines.inc.php # 修改字體為我們剛剛上傳的windows字體即可~
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]# grep -i simkai /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'simkai'); // font file name
define('ZBX_FONT_NAME', 'simkai');
[root@hadoop105.yinzhengjie.com ~]#
[root@hadoop105.yinzhengjie.com ~]#