zabbix服务器端安装好后,发现都是英语,对大部分人来说需要汉化下,才容易被接受,一下就是汉化的步骤,具体如下:
1,修改locales.inc.php文件中的中文支持打开把flase改为true(zabbix默认的是关闭的,实际上是支持中文的)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
[root@GJB-Monitor ~]
# vi /data/php/include/locales.inc.php
<?php
/*
** Zabbix
** Copyright (C) 2001-2016 Zabbix SIA
**
** This program is
free
software; you can redistribute it and
/or
modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed
in
the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License
for
more
details.
**
** You should have received a copy of the GNU General Public License
** along with this program;
if
not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
function
init_mbstrings() {
$res =
true
;
$res &= extension_loaded(
'mbstring'
);
if
(version_compare(PHP_VERSION,
'5.6'
,
'<'
)) {
ini_set(
'mbstring.internal_encoding'
,
'UTF-8'
);
$res &= (ini_get(
'mbstring.internal_encoding'
) ===
'UTF-8'
);
}
else
{
ini_set(
'default_charset'
,
'UTF-8'
);
$res &= (ini_get(
'default_charset'
) ===
'UTF-8'
);
}
ini_set(
'mbstring.detect_order'
,
'UTF-8, ISO-8859-1, JIS, SJIS'
);
$res &= (ini_get(
'mbstring.detect_order'
) ===
'UTF-8, ISO-8859-1, JIS, SJIS'
);
return
$res;
}
/**
* Returns a list of all used locales.
*
* Each locale has the following properties:
* - name - the full name of the locale
* - display - whether to display the locale
in
the frontend
*
* @
return
array an array of locales with locale codes as keys and arrays as values
*/
function
getLocales() {
return
[
'en_GB'
=> [
'name'
=> _(
'English (en_GB)'
),
'display'
=>
true
],
'en_US'
=> [
'name'
=> _(
'English (en_US)'
),
'display'
=>
true
],
'bg_BG'
=> [
'name'
=> _(
'Bulgarian (bg_BG)'
),
'display'
=>
false
],
'zh_CN'
=> [
'name'
=> _(
'Chinese (zh_CN)'
),
'display'
=>
true
],
'zh_TW'
=> [
'name'
=> _(
'Chinese (zh_TW)'
),
'display'
=>
false
],
'cs_CZ'
=> [
'name'
=> _(
'Czech (cs_CZ)'
),
'display'
=>
true
],
'nl_NL'
=> [
'name'
=> _(
'Dutch (nl_NL)'
),
'display'
=>
false
],
'fi_FI'
=> [
'name'
=> _(
'Finnish (fi_FI)'
),
'display'
=>
false
],
'fr_FR'
=> [
'name'
=> _(
'French (fr_FR)'
),
'display'
=>
true
],
'ka_GE'
=> [
'name'
=> _(
'Georgian (ka_GE)'
),
'display'
=>
false
],
'de_DE'
=> [
'name'
=> _(
'German (de_DE)'
),
'display'
=>
false
],
'el_GR'
=> [
'name'
=> _(
'Greek (el_GR)'
),
'display'
=>
false
],
'hu_HU'
=> [
'name'
=> _(
'Hungarian (hu_HU)'
),
'display'
=>
false
],
'id_ID'
=> [
'name'
=> _(
'Indonesian (id_ID)'
),
'display'
=>
false
],
|
2,在页面上进行设置:admin--user--language--chinese(zh_CN)
3,修改之后如果中文界面还出现乱码的话,解决方案为:
1,修改zabbix配置文件中的字体为微软雅黑字体修改配置文件include/defines.inc.php
1
2
3
|
[root@GJB-Monitor ~]
# vim /data/php/include/defines.inc.php
define(
'ZBX_FONT_NAME'
,
'DejaVuSans'
);
define(
'ZBX_GRAPH_FONT_NAME'
,
'DejaVuSans'
);
|
修改为:
1
2
|
define(
'ZBX_FONT_NAME'
,
'msyh'
);
define(
'ZBX_GRAPH_FONT_NAME'
,
'msyh'
);
|
2,在Windows系统下选择:控制面板\所有控制面板项\字体\微软雅黑-->右击复制--粘贴到相应的位置
3,把这两个文件拷贝到zabbix的web端的font目录下:/data/php/fonts
1
2
3
4
5
6
|
[root@GJB-Monitor ~]
# ll /data/php/fonts/
总用量 36264
-rw-r--r-- 1 zabbix zabbix 756072 8月 3 10:29 DejaVuSans.ttf
-rw-r--r-- 1 root root 14602860 6月 11 2009 msyhbd.ttf
-rw-r--r-- 1 root root 21767952 6月 11 2009 msyh.ttf
[root@GJB-Monitor ~]
#
|
在web端查看即为正常
本文转自 lqbyz 51CTO博客,原文链接:http://blog.51cto.com/liqingbiao/1833895