centos7.x之yum安装zabbix_proxy以及自动注册

前端之家收集整理的这篇文章主要介绍了centos7.x之yum安装zabbix_proxy以及自动注册前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

zabbix proxy就是所谓的分布式监控,主要是代理zabbix server进行采集数据,zabbix proxy端也需要搭建另外一个MysqL数据库,并且MysqL需要创建一个zabbix_proxy数据库.

如果你有多个proxy和一个zabbix server组合,这就可以叫分布式监控了。

zabbix proxy 只是一个进程 需要一个数据库 没有web界面 不会处理事件 也不会发送邮件 只是一个采集数据的功能


zabbix proxy的作用,官方描述

A Zabbix proxy can collect performance and availability data on behalf of the Zabbix server.This way,a proxy can take on itself some of the load of collecting data and offload the Zabbix server.


Also,using a proxy is the easiest way of implementing centralized and distributed monitoring,when all agents and proxies report to one Zabbix server and all data is collected centrally.


A Zabbix proxy can be used to:


Monitor remote locations

Monitor locations having unreliable communications

Offload the Zabbix server when monitoring thousands of devices 监控上万台服务器就靠他

Simplify the maintenance of distributed monitoring



先说说思路:安装zabbix proxy >安装MysqL数据库 >导入zabbix_proxy数据库结构 > 配置zabbix proxy(server ip 需要指向zabbix server地址) > 安装zabbix agent 并配置即可

#安装zabbixproxy
rpm-ivhhttp://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum-yinstallzabbix-proxyzabbix-proxy-MysqL
#安装数据库5.6
wgethttp://dev.MysqL.com/get/MysqL-community-release-el7-5.noarch.rpm
rpm-ivhMysqL-community-release-el7-5.noarch.rpm
yuminstallMysqL-community-server
systemctlrestartMysqLd.service
#设置msyql密码为123456
MysqL>setpasswordfor'root'@'localhost'=password('123456');

#远程连接设置,所有以root账号连接的远程用户,设其密码为123456
MysqL>grantallonxxxx.*to'root'@'%'identifiedby'123456'withgrantoption;

#更新权限
MysqL>flushprivileges;

#数据库开机启动
systemctlenableMysqLd.service
###创建MysqLzabbix_proxy数据库用户
MysqL–uroot–p
MysqL>createdatabasezabbix_proxycharactersetutf8;

MysqL>grantallprivilegesonzabbix_proxy.*to'zabbix'@'127.0.0.1'identifiedby'zabbix';

MysqL>flushprivileges;
#数据库导入zabbixschema.sql.gz
zcat/usr/share/doc/zabbix-proxy-MysqL-3.4.*/schema.sql.gz|MysqL-uzabbix-pzabbix_proxy

#登陆数据库
MysqL-uroot-p
#查看数据库,多了一个zabbix_proxy数据库
MysqL>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|MysqL|
|performance_schema|
|zabbix_proxy|
+--------------------+
4rowsinset(0.01sec)
#zabbixproxy配置文件
grep'^[a-Z]'/etc/zabbix/zabbix_proxy.conf

Server=zabbixserver端服务器ip地址
Hostname=Zabbixproxyfinal
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
SocketDir=/var/run/zabbix
DBHost=127.0.0.1
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
#zabbixagent客户端
grep'^[a-Z]'/etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=zabbixproxyip地址
ServerActive=zabbixproxyip地址
Hostname=Nginx02
Include=/etc/zabbix/zabbix_agentd.d/*.conf


#server 日志

#server日志
105825:20170920:155704.097cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105826:20170920:155705.108cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105826:20170920:155706.119cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105825:20170920:155707.128cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105826:20170920:155708.139cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105825:20170920:155709.149cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105826:20170920:155710.160cannotparseproxydatafromactiveproxyat"xx.xx.xx.xx":proxy"Zabbixproxyfinal"notfound
105825:20170920:164017.897sendingconfigurationdatatoproxy"Zabbixproxyfinal"at"xx.xx.xx.xx",datalen8172
105800:20170920:165042.107executinghousekeeper
105800:20170920:165052.563housekeeper[deleted37754hist/trends,0items,0events,0problems,0sessions,0alarms,0audititemsin10.439203sec,idlefor1hour(s)]
#按照我的推断是,server端没有及时发送配置数据给proxy,应该是同步配置问题。这个过程中,我差不多度娘了一个小时,突然发现自己可以监控数据了。
后面我都试验了几次,时间长就可以正常同步了。只要server端发送数据给proxy

#proxy日志

#zabbix_proxy日志
t[Nginx02]notfound
17523:20170920:163748.893cannotsendlistofactivechecksto"127.0.0.1":host[Nginx02]notfound
17523:20170920:163948.912cannotsendlistofactivechecksto"127.0.0.1":host[Nginx02]notfound
17504:20170920:164140.772receivedconfigurationdatafromserverat"xx.xx.xx.xx",datalen8172
17516:20170920:164150.825enablingZabbixagentchecksonhost"Nginx02":hostbecameavailable

#检查proxy是否为一个进程

[root@Nginx02~]#ps-ef|grepproxy
zabbix175031015:41?00:00:00/usr/sbin/zabbix_proxy-c/etc/zabbix/zabbix_proxy.conf
zabbix1750417503015:41?00:00:00/usr/sbin/zabbix_proxy:configurationsyncer[syncedconfig13741bytesin0.079034sec,idle3600sec]
zabbix1750517503015:41?00:00:00/usr/sbin/zabbix_proxy:heartbeatsender[sendingheartbeatmessagesuccessin0.014880sec,idle60sec]
zabbix1750617503015:41?00:00:04/usr/sbin/zabbix_proxy:datasender[sent1valuesin0.018079sec,sendingdata]
zabbix1750717503015:41?00:00:00/usr/sbin/zabbix_proxy:housekeeper[deleted2169recordsin0.034788sec,idlefor1hour(s)]
zabbix1750817503015:41?00:00:00/usr/sbin/zabbix_proxy:httppoller#1[got0valuesin0.000464sec,idle5sec]
zabbix1750917503015:41?00:00:00/usr/sbin/zabbix_proxy:discoverer#1[processed0rulesin0.000326sec,idle60sec]
zabbix1751017503015:41?00:00:00/usr/sbin/zabbix_proxy:historysyncer#1[synced0itemsin0.000001sec,idle1sec]
zabbix1751117503015:41?00:00:00/usr/sbin/zabbix_proxy:historysyncer#2[synced0itemsin0.000001sec,idle1sec]
zabbix1751217503015:41?00:00:00/usr/sbin/zabbix_proxy:historysyncer#3[synced1itemsin0.008008sec,idle1sec]
zabbix1751317503015:41?00:00:00/usr/sbin/zabbix_proxy:historysyncer#4[synced0itemsin0.000001sec,idle1sec]
zabbix1751417503015:41?00:00:00/usr/sbin/zabbix_proxy:self-monitoring[processeddatain0.000004sec,idle1sec]
zabbix1751517503015:41?00:00:00/usr/sbin/zabbix_proxy:taskmanager[processed0task(s)in0.000326sec,idle5sec]
zabbix1751617503015:41?00:00:00/usr/sbin/zabbix_proxy:poller#1[got0valuesin0.000003sec,idle1sec]
zabbix1751717503015:41?00:00:00/usr/sbin/zabbix_proxy:poller#2[got0valuesin0.000003sec,idle1sec]
zabbix1751817503015:41?00:00:00/usr/sbin/zabbix_proxy:poller#3[got1valuesin0.000417sec,idle1sec]
zabbix1751917503015:41?00:00:00/usr/sbin/zabbix_proxy:poller#4[got0valuesin0.000003sec,idle1sec]
zabbix1752017503015:41?00:00:00/usr/sbin/zabbix_proxy:poller#5[got0valuesin0.000003sec,idle1sec]
zabbix1752117503015:41?00:00:00/usr/sbin/zabbix_proxy:unreachablepoller#1[got0valuesin0.000004sec,idle5sec]
zabbix1752217503015:41?00:00:00/usr/sbin/zabbix_proxy:trapper#1[processeddatain0.000000sec,waitingforconnection]
zabbix1752317503015:41?00:00:00/usr/sbin/zabbix_proxy:trapper#2[processeddatain0.020794sec,waitingforconnection]
zabbix1752417503015:41?00:00:00/usr/sbin/zabbix_proxy:trapper#3[processeddatain0.000000sec,waitingforconnection]
zabbix1752517503015:41?00:00:00/usr/sbin/zabbix_proxy:trapper#4[processeddatain0.000713sec,waitingforconnection]
zabbix1752617503015:41?00:00:00/usr/sbin/zabbix_proxy:trapper#5[processeddatain0.000000sec,waitingforconnection]
zabbix1752717503015:41?00:00:00/usr/sbin/zabbix_proxy:icmppinger#1[got0valuesin0.000005sec,idle5sec]
root3109431000018:22pts/000:00:00grep--color=autoproxy


刚配置提示错误

17506:20170920:154253.213 cannot send proxy data to server at "xx.xx.xx.xx": proxy "Zabbix proxy final" not found

17506:20170920:154254.228 cannot send proxy data to server at "xx.xx.xxx.xx": proxy "Zabbix proxy final" not found


web方面操作

第一个步骤配置agent代理程序

第二个步骤配置自动注册

配置完毕,所有经过proxy添加的主机,都会自动配置,不用手动一个一个添加了。

猜你在找的CentOS相关文章