环境准备
centos7.1环境
zabbix-server 172.16.1.100 node1.example.com
zabbix-agent 172.16.1.101 node2.example.com
首先关闭防火墙与selinux
[root@node1 ~]# systemctl stop firewalld.service
[root@node1 ~]# systemctl disable firewalld.service
setenforce 0 临时关闭selinux ,如永久关闭需要修改配置文件 /etc/sysconfig/selinux
先安装rpm源,server &&agent
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
2. 安装数据库,server端
yum install zabbix-server-mysql zabbix-web-mysql -y
yum install mariadb-server -y
3.启动数据库
# systemctl restart mariadb
4.创建zabbix数据库
#mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit;
5.导入zabbix数据库到mysql
zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
6.设置server端配置文件
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
7.启动server并加入开机启动
# systemctl start zabbix-server
# systemctl enable zabbix-server
8.配置web端配置文件
vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Asia/Shanghai
9.启动httpd,并加入开机启动
systemctl start httpd systemctl enable httpd
systemctl enable mariadb
10.执行安装web端,安装完毕默认帐号密码为Admin/zabbix
11.agent安装
yum install zabbix-agent
12.编辑agent配置文件设置server地址 /etc/zabbix/zabbix_agentd.conf
其中server配置为被动模式,serveractive配置为主动模式,
[root@node2 ~]# cat /etc/zabbix/zabbix_agentd.conf | grep -v ^# | grep -v ^$
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.1.100
#ServerActive=127.0.0.1
Hostname=node2.example.com
Include=/etc/zabbix/zabbix_agentd.d/*.conf
13.启动agent
# systemctl start zabbix-agent
# systemctl enable zabbix-agent