Zabbix实战-简易教程--技巧(本地化)

 1.zabbixlogo图标替换(不建议修改)

3.0版本以下:

1.修改/usr/share/zabbix/include/page_header.php

2.修改/usr/share/zabbix/styles/icon.css

3.0版本以上:

/usr/share/zabbix/img/browser-sprite.png(修改此图片)

2.修改支持中文字体

/usr/share/zabbix/include/locales.inc.php

3.解决中文字体乱码:

1) 在windows系统中的c:windowsfonts目录中copy一个自己喜欢的字体文出来,如mysh.ttf(雅黑);

2) 将copy出来的字体上传到Zabbix Server网站目录中的fonts目录下;

3) 将Zabbix Server网站目录中的fonts目录里原来的“DejaVusSans.ttf”改名,例如改为“DejaVusSans-bak.ttf”;

4) 将上传上去的文件,例如“mysh.ttf”改为“DejaVusSans.ttf”

5) 重新打开Zabbix Web测试!

4.修改浏览器右侧Logo

/etc/zabbix/web/zabbix.conf.php

5.汉化补丁

 /usr/share/zabbix/locale/zh_CN/LC_MESSAGES 目录下:

操作:

frontend.po文件更新
执行脚本:
/bin/bash update_po.sh
/bin/bash make_mo.sh
效果图:

6、Graphtrees安装

1、插件安装

#Zabbix-web目录

cd /usr/share/zabbix

# 下载Graphtree补丁包

wget https://raw.githubusercontent.com/OneOaaS/graphtrees/master/graphtree3-0-1.patch

# 安装Linux下打补丁命令patch

yum -y install patch

# 打补丁

patch -Np0 < graphtree3-0-1.patch
[root@bgp-bjlg-zabbix-server01 zabbix]# patch -Np0 < graphtree3-0-1.patch
patching file ./README.md
patching file ./biggraph.php
patching file ./graphtree.left.php
The next patch would delete the file graphtree/graphtree.patch,
which does not exist!  Skipping patch.
1 out of 1 hunk ignored
patching file ./graphtree.right.php
patching file ./graphtrees.php
patching file ./hosts.php
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ./hosts.php.rej
patching file ./img/icon-sprite.svg
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ./img/icon-sprite.svg.rej
patching file ./img/oneoaas-wechat.jpg
patching file ./include/func.inc.php
Hunk #1 succeeded at 2321 with fuzz 2 (offset 28 lines).
patching file ./include/menu.inc.php
Hunk #1 FAILED at 22.
1 out of 1 hunk FAILED -- saving rejects to file ./include/menu.inc.php.rej
patching file ./include/page_header.php
patching file ./js/vendors/highlight.min.js
patching file ./js/vendors/jquery.ztree.core-3.5.js
patching file ./jsLoader.php
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ./jsLoader.php.rej
patching file ./locale/lt/LC_MESSAGES/frontend.po
Reversed (or previously applied) patch detected!  Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file ./locale/lt/LC_MESSAGES/frontend.po.rej
patching file ./locale/lv/LC_MESSAGES/frontend.po
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file ./locale/lv/LC_MESSAGES/frontend.po.rej
patching file ./locale/pt_BR/LC_MESSAGES/frontend.po
Reversed (or previously applied) patch detected!  Skipping patch.
6 out of 6 hunks ignored -- saving rejects to file ./locale/pt_BR/LC_MESSAGES/frontend.po.rej
patching file ./styles/ztree/line_conn.gif
patching file ./styles/ztree/loading.gif
patching file ./styles/ztree/zTreeStandard.gif
patching file ./styles/ztree/zTreeStandard.png
patching file ./styles/ztree/zTreeStyle.css

7、 主机名/触发器支持中文

 

在/usr/share/zabbix/include/defines.inc.php文件中修改943行(zabbix-2.2.4),加入中文字符支持,使主机名支持中文支持:

define('ZBX_PREG_INTERNAL_NAMES', '([0-9a-zA-Z_. -]+)');

修改为:

// x80-xff:匹配用GBK (GB2312/GB18030)编码的所有汉字和标点符号
define('ZBX_PREG_INTERNAL_NAMES', '([0-9a-zA-Z_. -x{80}-x{ff}]+)');/* !!! Don't forget sync code with C !!! */

 在/usr/share/zabbix/include/classes/parsers/CTriggerExpression.php文件中修改808行(zabbix-2.2.4),使触发器表达式支持中文:

修改为:

 private function isHostChar($c) {
                $cc=ord($c);
                if (($c >= 'a' && $c <= 'z') || ($c >= 'A' && $c <= 'Z') || ($c >= '0' && $c <= '9')
                                || $c == '.' || $c == ' ' || $c == '_' || $c == '-' || $cc > 127) {
                        return true;
                }
 
                return false;
        }

8、前端报警声音修改

声音文件替换

目录:/usr/share/zabbix/audio

原文地址:https://www.cnblogs.com/skyflask/p/7507642.html