zabbix 安装配置汉化

来源:互联网 发布:知乎互联网金融拓展 编辑:程序博客网 时间:2024/06/10 01:59

预备

首先到官网
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages/repository_installation

这里根据你自己的系统安装一些信赖的证书,或者称为组件。

为了能够快速使用,我并没有深究。

安装完成后,
Now you are ready to install Zabbix server with MySQL or server with PostreSQL, agent and proxy.

zabbix 需要使用mysql或者postresql作为数据库支持,我选择自己比较熟悉的mysql

mysql

https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages/server_installation_with_mysql#debianubuntu

如果你之前没有安装过mysql,这里不会出现什么其他问题。如果你之前在机器上安装过,可能会有一点点的问题。但是既然你安装过,就不要怕碰到问题,你要相信,我们会解决它。

apt-get install zabbix-server-mysql zabbix-frontend-php

我建议你分开安装,先安装mysql ,在安装php .
这样哪个环节有问题,方便定位解决,不然log太多,分不清楚。

mysql 大概180M左右(之前为安装过),过程中提示输入root的密码,也就是作为mysql root的密码,这个一定要牢记,丢失很麻烦。

mysql start/running, process 12501Setting up libiksemel3 (1.2-4.2) ...Setting up libopenipmi0 (2.0.18-0ubuntu7.2) ...Setting up fping (3.8-1) ...Setting up zabbix-server-mysql (1:3.2.7-1+trusty) ...Setting up libhtml-template-perl (2.95-1) ...Setting up mysql-common-5.6 (5.6.33-0ubuntu0.14.04.1) ...Setting up snmpd (5.7.2~dfsg-8.1ubuntu3.2) ...update-rc.d: warning:  stop runlevel arguments (1) do not match snmpd Default-Stop values (0 1 6) * Starting network management services:                                                                            Processing triggers for libc-bin (2.19-0ubuntu6.9) ...Processing triggers for ureadahead (0.100.0-16) ...

我这里没有出错,一个warning不打紧。

php

也就是上面提到的分开安装

apt-get install zabbix-frontend-php

大约50M.

apache2_invoke: Enable module php5 * Restarting web server apache2                                                                                    AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 219.228.12.113. Set the 'ServerName' directive globally to suppress this message                                                                                                             [ OK ]Setting up php5 (5.5.9+dfsg-1ubuntu4.21) ...Setting up zabbix-frontend-php (1:3.2.7-1+trusty) ...update-alternatives: using /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf to provide /usr/share/zabbix/fonts/graphfont.ttf (zabbix-frontend-font) in auto modeEnabling conf zabbix.To activate the new configuration, you need to run:  service apache2 reloadProcessing triggers for libc-bin (2.19-0ubuntu6.9) ...

没有错误信息,但是提示要配置文件 。

创建mysql表

shell> mysql -uroot -p<root_password>mysql> create database zabbix character set utf8 collate utf8_bin;mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';mysql> quit;

就是你安装mysql时创建的root密码

这里具体不知道是什么,不过我使用了zabbix

然后要初始化,执行

zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

会提示你输入密码,因为我上面使用的zabbix,所以这里也输入zabbix.
然后终端看上去没有反应,这里稍作等待,看机器性能,我大约等了5秒钟,完成初始化。

配置zabbix_server

# vi /etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=<password>

就是刚刚我是用zabbix

# service zabbix-server start# update-rc.d zabbix-server enable

启动服务,并且设置为开机启动。

zabbix php配置

vi /etc/zabbix/apache.conf

php_value max_execution_time 300php_value memory_limit 128Mphp_value post_max_size 16Mphp_value upload_max_filesize 2Mphp_value max_input_time 300php_value always_populate_raw_post_data -1php_value date.timezone Asia/Shanghai

前面的配置项已经有了,只要把最后一行的时区改成 Asia/Shanghai
并去掉注释。php5,php7中最好都配置一下

前台配置

https://www.zabbix.com/documentation/3.2/manual/installation/install#installing_frontend

访问
http://ip/zabbix/setup.php

没问题直接点击下一步
需要配置下
Configure DB connection 这一页的password
我的这里是zabbix

后面默认就可以了。

完成后zabbix的默认用户名密码为
Admin/zabbix

注意Admin 要大写

调出汉语选项

修改

whereis zabbix
vim /usr/share/zabbix/include/locales.inc.php'zh_CN' => ['name' => _('Chinese (zh_CN)'),     'display' => true]

如果已经为true 但是还是不能选择。

为系统安装中文包

apt-get install language-pack-zh-hant language-pack-zh-hans

配置

 sudo vi /etc/environment在文件中增加语言和编码的设置:LANG="zh_CN.UTF-8"LANGUAGE="zh_CN:zh:en_US:en"

重启

sudo dpkg-reconfigure localesservice apache2 restart

现在可以勾选了,但是如果作图,还是汉字会出现空格,因为没有字体。

mkdir testcd test wget http://dx.sc.chinaz.com/Files/DownLoad/font2/dd.rar apt-get install unrar unrar x dd.rar cd ddcp msyh.ttf /usr/share/zabbix/fonts/vim /usr/share/zabbix/include/defines.inc.php

修改

define(‘ZBX_GRAPH_FONT_NAME’, ‘graphfont’); // font file name 

define(‘ZBX_GRAPH_FONT_NAME’, ‘msyh’); // font file name

重启完成