Zabbix3.4安装部署

Zabbix3.4安装部署

一、系统环境
cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
 
关闭防火墙及selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0

2、安装mariadb
yum install mariadb-server mariadb -y
配置数据库的相关信息:
/etc/my.cnf

 [mysqld]
 datadir=/home/mysql
 socket=/var/lib/mysql/mysql.sock
 innodb_file_per_table=1 #打开InnoDB引擎独立表空间

mariadb数据库启动:
systemctl start mariadb  #启动MariaDB
systemctl enable mariadb  #设置开机启动
登录数据库查看独立表空间

 MariaDB [(none)]> show variables like '%per_table%'; #查看独立表空间是否打开
 +-----------------------+-------+
 | Variable_name | Value |
 +-----------------------+-------+
 | innodb_file_per_table | ON |
 +-----------------------+-------+
 1 row in set (0.00 sec)


zabbixe中文文档 https://www.zabbix.com/documentation/3.4/zh/manual
2、Zabbix3.4安装
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql -y
 
3、创建数据库
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
 
4、导入数据
zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -pzabbix zabbix

 设置数据库root密码、默认为空、设置mysql安全参数命令:
 mysql_secure_installation

5、配置数据库用户及密码
grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
99:DBName=zabbix
115:DBUser=zabbix
123:DBPassword=zabbix
314:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
432:Timeout=4
474:AlertScriptsPath=/usr/lib/zabbix/alertscripts
484:ExternalScripts=/usr/lib/zabbix/externalscripts
520:LogSlowQueries=3000
 
6、启动zabbix server并设置开机启动
systemctl enable zabbix-server
systemctl start zabbix-server
 
7、编辑Zabbix前端PHP配置,更改时区
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

8、启动httpd并设置开机启动
systemctl start httpd
systemctl enable httpd
systemctl start zabbix-server.service
systemctl enable zabbix-server.service

9、安装客户端
yum install zabbix-agent
systemctl enable zabbix-agent.service
systemctl start zabbix-agent.service

zabbix中文乱码

通过zabbix管理界面的profile ——> Language 可以修改系统的默认语言设置 。默认是English(en_GB) ,通过下拉选项选择Chinese(zh_CN)并按save保存后,可以更改默认语言为中文 。更改完成后大部分页面显示是没问题的,不过在maps screen graphs 时,会出现汉字无法显示 ------ 显示为口口 。

出现该问题的原因是因为zabbixweb端没有中文字库,把中文字库加上即可 。解决方法可以由下面几步完成:

1、复制字体文件

windows下控制面板->字体->选择一种中文字库例如楷体”  ,复制出来的字体文件为simkai.ttf

[root@linux-node1-example zabbix]# pwd #路径
/usr/share/zabbix
[root@linux-node1-example zabbix]# cd fonts #在该路径下存放下载的字体
[root@linux-node1-example fonts]# ls
graphfont.ttf  simkai.ttf
[root@linux-node1-example fonts]#
2、修改defines.inc.php文件
修改zabbix的web端/include/defines.inc.php :
sed -i 's/graphfont/simkai/g' /usr/share/zabbix/include/defines.inc.php

如果是编译安装的可能不在这个路径可以find查找该文件
find / -name "defines.inc.php"

修改完成后,刷新页面,效果如下:

原文地址:https://www.cnblogs.com/w787815/p/9607716.html