Ubunbu12.04下zabbix解决无中文语言及中文乱码修改

来源:互联网 发布:win10怎么忘记网络 编辑:程序博客网 时间:2024/05/07 19:34

页面错误提示:You are not able to choose some of the languages, because locales for them are not installed on the web server
一、查看系统内安装的locale:locale -a

这是由于我系统安装时未装入中文语言包,安装zh_CN.UTF-8,root@cserver:~# locale-gen zh_CN.UTF-8。
二、zabbix端设置
cmp@ubuntu117:~$ sudo dpkg-reconfigure locales #重新配制系统已经安装的语言包
cmp@ubuntu117:~$ sudo vim /usr/share/zabbix/include/locales.inc.php #编辑源码文件
在文件中找到函数"getLocales()"
'en_GB' => array('name' => _('English (en_GB)'), 'display' => true),
可以把你不需要的语言设置为false,有些版本默认不支持中文,可以找到'zh_CN'这一行把flase改为true
最后保存文件;

cmp@ubuntu117:~$  sudo service apache2 restart,重启apache。


三、zabbix web端设置及中文乱码解决
此时进入到server端页面点开profile中文可选,保存后如下:

zabbix图形显示中文乱码解决方法:
1. 进入 C:\Windows\Fonts 选择其中任意一种中文字体例如 “楷体” ( SIMKAII.TTF )
2. 将 Windows 下的中文字体文件( for example: simkai.ttf ) 上传到 zabbix web 目录( Default  : /usr/share/zabbix )下的 fonts 目录 ( Default: /usr/share/zabbix/fonts )
3. 修改zabbix的web前端的字体设置,将如下两行修改为:
cmp@ubuntu117:~$  vim /usr/share/zabbix/include/define.inc.php
define('ZBX_GRAPH_FONT_NAME', 'graphfont');
define('ZBX_GRAPH_FONT_NAME', 'graphfont');
修改为
define('ZBX_FONT_NAME', 'simkai');
define('ZBX_GRAPH_FONT_NAME', 'simkai');
其中simkai为字库名字,不用写ttf后缀。
依旧乱码:通过以上的操作,大部分乱码问题解决了,但是依旧还会有乱码?
一种情况:初始化数据库的时候未使用 utf8 编码所致.初始化数据库使用命令
create database zabbix default charset utf8;
或者 my.cnf 增加如下配置
default-character-set = utf8

原创粉丝点击