环境:
zabbix-server:192.168.216.8
zabbix-proxy:192.168.216.7
zabbix-agent:192.168.216.2
一、zabbix-server:参照zabbix3.0安装
配置proxy:
1、
2、
3
4
二、zabbix-proxy
1、数据库安装配置
[root@zabbix-server zabbix]# yum isntall mariadb-server -y
[root@zabbix-server zabbix]# systemctl start mariadb.service
MariaDB [(none)]> CREATE DATABASE proxy;#创建proxy库
MariaDB [(none)]> GRANT ALL PRIVILEGES ON proxy.* TO proxy@'127.0.0.1' IDENTIFIED BY 'proxypass';#授权proxy
MariaDB [(none)]> FLUSH PRIVILEGES;#刷新
[root@zabbix-server zabbix]# gizp -d /usr/share/doc/zabbix-proxy-mysql-3.0.5/schema.sql.gz#解压schema.sql.gz
[root@zabbix-server zabbix]# mysql -u proxy -p -h227.0.0.1 proxy < /usr/share/doc/zabbix-proxy-mysql-3.0.5/schema.sql#把schema.sql导入到数据库proxy中
2、配置zabbix-proxy并安装
[root@zabbix-server zabbix]# yum isntall zabbix-get zaabix-sender zabbix-proxy-mysql
[root@zabbix-server zabbix]# grep -v "^#" zabbix_proxy.conf
Server=192.168.216.8 #zabbix-service
Hostname=p1.xiaosheng.com#定义全局唯一标示与proxies的hostname一致
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBHost=127.0.0.1#定义数据库地址
DBName=proxy#定义数据库库
DBUser=proxy#定义数据库用户名
DBPassword=proxypass#定义数据库密码
DBSocket=/var/lib/mysql/mysql.sock#定义数据库sock
ProxyOfflineBuffer=2#离线缓存时长,默认2个小时
ConfigFrequency=10#拉取zabbix-server时长,默认秒
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
三、配置zabbix-agent并配置
[root@ansible-zproxy zabbix]# yum install zabbix-agent zabbix-get zabbix-sender
[root@ansible-zproxy zabbix]# grep -v "^#" zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=512
EnableRemoteCommands=1
LogRemoteCommands=1
Server=127.0.0.1, 192.168.216.7#定义被动允许get的主机
ServerActive=127.0.0.1, 192.168.216.7#定义主动sender的主机
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/