mayiwen123456 发表于 2017-2-23 10:59:56

Centos7安装Zabbix3.0 安装过程

本帖最后由 mayiwen123456 于 2017-8-8 16:06 编辑

对于新手安装zabbix,最好先把防火墙和selinux关闭。
1. 关闭防火墙:
systemctl stop firewalld.service
systemctl disable firewalld.service
如果不关闭防火墙,请放通以下端口:
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
systemctl restart firewalld
关闭selinux:
# setenforce 0
# sed -i "s/^SELINUX\=enforcing/SELINUX\=disabled/g" /etc/selinux/config
或者vim /etc/selinux/config //直接关闭selinux
disabled

2.配置yum源
https://www.zabbix.com/documenta ... sitory_installation

rpm -ivh http://repo.zabbix.com/zabbix/3. ... .0-1.el7.noarch.rpm
3.安装服务器端包
yum install -y zabbix-server-mysql.x86_64 zabbix-web-mysqlzabbix-agentmariadb-server
报错:
Another app is currently holding the yum lock; waiting for it to exit...
解决:
rm -f /var/run/yum.pid //强制关掉yum进程
重装安装zabbix等
4.启动mariadb //由于Mysql被Oracle收购,所以从Centos7开始不再默认安装Mysql而用Mariadb代替
systemctl start mariadb
systemctl enable mariadb
vim /etc/my.cnf
character-set-server=utf8
innodb_file_per_table=1
ps -ef | grep mysql
5.创建zabbix数据库
mysqladmin -uroot password admin
mysql -uroot -padmin
MariaDB [(none)]>create database zabbix character set utf8;
MariaDB [(none)]>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]>flush privileges;
6.导入数据
cd /usr/share/doc/zabbix-server-mysql-3.0.7/
gunzip create.sql.gz
mysql -uzabbix -pzabbix
use zabbix;
MariaDB >source /usr/share/doc/zabbix-server-mysql-3.0.7/create.sql;
7.配置zabbix_server
vi /etc/zabbix/zabbix_server.conf
91:DBName=zabbix
107:DBUser=zabbix
116:DBPassword=zabbix
systemctl start zabbix-server //启动时报错,如下
zabbix_server: segfault at 18 ip 00007f78842b4bd0 sp 00007fff1995a818 error 4 in libpthread-2.17.so
解决方法:升级trousers到0.3.13版本直接yum update trousers就可以了//
(登录后zabbix监控报错zabbix server is not running: the information displayed may not be current)。
systemctl enable zabbix-server
8.配置http
vim /etc/httpd/conf.d/zabbix.conf
      php_valuemax_execution_time 300
      php_valuememory_limit 128M
      php_valuepost_max_size 16M
      php_valueupload_max_filesize 2M
      php_valuemax_input_time 300
      php_valuealways_populate_raw_post_data -1
      #php_value date.timezone Europe/Riga
      php_valuedate.timezone Asia/Shanghai
systemctl start httpd.service
systemctl enable httpd.service
登录后zabbix监控报错zabbix server is not running: the information displayed may not be
current;更新trousers重新启动zabbix-server。
以下为agent安装
zabbix_agent安装配置
yum install zabbix-agent -y
vim /etc/zabbix/zabbix_agentd.conf
Server=server端ip地址                      #用于被动模式,数据获取
ServerActive=server端ip地址                #用于主动模式,数据提交
这里的主动模式还有被动模式的出发点都是agent端,所以agent主动向server端发送数据就成为主动模式,而等待server端主动获取数据则称为被动模式。
agent端安装比较简单.至此已经安装完毕。
systemctrl start zabbix-agent            #启动zabbix agent
systemctl enable zabbix-agent.service#开机启动zabbix agent

大象无形 发表于 2017-2-25 09:24:11

sed -i'/SELINUX/s/enforcing/disabled/' /etc/selinux/config写错了
页: [1]
查看完整版本: Centos7安装Zabbix3.0 安装过程