linux

CenOS 7.2 安装 zabbix-proxy

发布时间:7年前热度: 3828 ℃评论数:

一、系统环境


CentOS Linux release 7.2.1511 (Core)

zabbix-server 10.80.6.12

zabbix-proxy 10.80.6.9


zabbix proxy使用场景:

22.png

二、开始安装

1、zabbix-prox环境准备

systemctl stop firewalld
systemctl disable firewalld
 
setenforce 0

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

yum install  mysql-connector-odbc libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel libssh2-devel wget fping -y

2、安装mariadb或者msyql数据库

yum install -y mariadb mariadb-server mariadb-devel

systemctl start mariadb && systemctl enable mariadb

3、创建proxy数据库,proxy用户

mysql> create database zabbix_proxy character set utf8;

mysql> GRANT ALL PRIVILEGES ON zabbix_proxy.* to 'zabbix'@'localhost' IDENTIFIED BY 'zhl123';

mysql> flush privileges;

4、安装proxy

wget https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-agent-3.0.22-1.el7.x86_64.rpm

wget https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-proxy-mysql-3.0.22-1.el7.x86_64.rpm

wget https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-get-3.0.22-1.el7.x86_64.rpm

yum localinstall zabbix* -y

5、导入表结构

zcat /usr/share/doc/zabbix-proxy-mysql-3.0.22/schema.sql.gz  | mysql -uroot -p zabbix_proxy

6、编辑配置文件

proxy配置

# cat /etc/zabbix/zabbix_proxy.conf |grep -v "^#"|grep -v "^$"

Server=10.80.6.12

Hostname=10.80.6.9

LogFile=/var/log/zabbix/zabbix_proxy.log

LogFileSize=0

PidFile=/var/run/zabbix/zabbix_proxy.pid

DBHost=127.0.0.1

DBName=zabbix_proxy

DBUser=zabbix

DBPassword=zhl123

ConfigFrequency=120 #主动去server端去拉去配置更新的频率120秒一次

DataSenderFrequency=60  #发送采集的监控数据到服务器端,默认是1秒,我们一分钟发送一次

StartDiscoverers=4

JavaGateway=127.0.0.1

StartJavaPollers=4

SNMPTrapperFile=/var/log/snmptrap/snmptrap.log

Timeout=4

ExternalScripts=/usr/lib/zabbix/externalscripts

LogSlowQueries=3000


agent配置

# 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=10.80.6.9

ServerActive=10.80.6.9

Hostname=10.80.6.9

Include=/etc/zabbix/zabbix_agentd.d/

7、启动服务并检查测试

# systemctl start zabbix-proxy zabbix-agent

# systemctl enable zabbix-proxy zabbix-agent

23.jpg

zabbix_get  -s 172.26.0.16 -k agent.ping

1

8、zabbix-server端配置

24.jpg

25.jpg

9、客户端配置

# vim /etc/zabbix/zabbix_agentd.conf  #下面是要修改的地方

Server=10.80.6.9        #agentd被动模式下的server或者proxy的IP地址

ServerActive=10.80.6.9  #如果agentd端是被动模式的话,此条和下面那条并不非用配置,但是如果agentd端是主动模式的话,此条一定要配置上。

Hostname=172.26.0.16


安装

手机扫码访问