"Learn Zabbix with Me" 1.1 Zabbix Proxy (primary/deployed)

Source: Internet
Author: User

In the official latest Zabbix 2.4 distributed architecture, there is no support in addition to node mode.

I also used node in the 2.x version of the multi-tier distributed node mode has been repeatedly encountered in the server configuration consistency confusion, and repair is very troublesome.

So the "Learn from Me series" does not introduce node deployment.

The purpose of using the proxy is also obvious: reduce the server's acquisition pressure or cross-carrier network monitoring quality is not good, or in the middle of the monitoring link with a firewall device and so on ....


1. Environmental preparedness

CentOS 6.4

Turn off SELinux and iptables

Installing repo:http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm

5 Virtual machines: 1 Zabbix servers

2 units Zabbix Proxy (one active, one passive)

2 Zabbix Client (one active acquisition, one passive acquisition)


192.168.188.30 Server192.168.188.31 Proxy (Active) 192.168.188.32 proxy (pass) 192.168.188.33 Client (Active) 192.16 8.188.34 Client (pass)



In fact, when you are doing this experiment, it is perfectly possible to use 2 or three virtual machines.

1 Zabbix Server, 1 Zabbix Proxy

Zerver Collect data through proxy, proxy collects itself.

650) this.width=650; "src=" Http://pic.yupoo.com/kinda22/EfisQC4r/1ahBC.png "alt=" 1ahbc.png "height=" 246 "width=" 600 "/>



2. Zabbix Server Deployment

Please refer to "Learn Zabbix with Me" 1.0 Zabbix C/S architecture for rapid deployment



3. Zabbix Proxy Deployment

#在所有的Proxy上执行 installation initialization .... Yum install zabbix-proxy-mysql zabbix-agent mysql-server mysql-y/etc/init.d/mysqld startmysql- E "CREATE database Zabbix_proxy character set UTF8 collate utf8_bin;" MYSQL-E "Grant all privileges in zabbix_proxy.* to [e-mail protected] identified by ' Zabbix ';" Cd/usr/share/doc/zabbix-proxy-mysql-2.4.2/create/mysql-uroot Zabbix_proxy < schema.sqlsed-i ' s/^.*DBPassword=.* $/dbpassword=zabbix/'/etc/zabbix/zabbix_proxy.confcp/etc/zabbix/zabbix_proxy.conf{,.bak}


a) proxy active mode

Active mode: The server enables the capture process to receive unsolicited data ... (Agent active, sender or proxy), proxy collects data, and then proactively pushes the data to the server.

Common application scenarios such as: Server can expose IP and port, proxy cannot be exposed.

In active mode, the time to configure the retrieval, heartbeat, and data sending frequency are defined independently by each proxy in the configuration file.

1. Start the capture process on the server

#192.168.188.30# in Server execution: Sed-i ' s/.*starttrappers=.*$/starttrappers=10/'/etc/zabbix/zabbix_server.confservice zabbix-server restart


2. Proxy is mainly configured as follows

#192.168.188.31# in proxy to modify the hostname, this hostname is very important, and the following must be Web ui in the name of the same hostname .sed -i  ' s/hostname=.*/hostname= proxy-active/'  /etc/sysconfig/networkhostname proxy-activecat > /etc/zabbix/zabbix_ proxy.conf <<eofserver=192.168.188.30                       #填写Server的IP, Proxy sends the collected data to this IP. hostnameitem=system.hostname                #通过内部的key获取当前主机名. Logfile=/var/log/zabbix/zabbix_proxy.log  logfilesize=0pidfile=/var/run/zabbix/zabbix_ proxy.piddbname=zabbix_proxy                         #Proxy连接的数据库DBUser =zabbix                                #连接数据库的用户名DBPassword =zabbix                           #连接数据库的秘密DBSocket =/var/lib/mysql /mysql.sockproxylocalbuffer=0                          #当数据发送到Server, How many hours are still to be kept locally. proxyofflinebuffer=3             not retained            #当数据没有发送到Server, how many hours in the local reservation, 3 hours. heartbeatfrequency=60                       #心跳检测代理在Server的可用性ConfigFrequency =300                        # How often the agent gets configuration changes from the server by default of 3,600 seconds. Datasenderfrequency=3                      #代理收集到数据后, How long to send to the server once: externalscripts=/usr/lib/zabbix/externalscriptseof/etc/init.d/zabbix-proxy startchkconfig  Zabbix-proxy on


3. Configure Client Active

#192.168.188.33# first modifies the hostname sed-i ' s/hostname=.*/hostname=client-active/'/etc/sysconfig/in client-active Networkhostname client-activeyum install zabbix-agent-ysed-i ' s/server=.*/server=192.168.188.31/'/etc/zabbix/ zabbix_agentd.conf #这里的ServerIP要填写oroxy-active's sed-i ' s/serveractive=.*/serveractive=192.168.188.31/'/etc/z Abbix/zabbix_agentd.conf #这里的ServerIP是用于Agent (Active) mode. Sed-i ' s/^hostname=\ (. *\)/#Hostname =\1/'/etc/zabbix/zabbix_        agentd.conf #将默认静态的主机名注释sed-i ' s/.*hostnameitem=\ (. *\)/hostnameitem=\1/'/etc/zabbix/zabbix_agentd.conf #使用内部key来获取动态的主机名/etc/init.d/zabbix-agent startchkconfig zabbix-agent on


4. Configure on the server Web :

Create a new agent

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/EfhW4bCa/EDa8q.jpg "alt=" eda8q.jpg "height=" 235 "width=" 600 "/>


The name of the agent is important, be sure to match the hostname (configured in proxy to get host name dynamically)

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/EfhW4lcy/zAx1.jpg "alt=" zax1.jpg "height=" 435 "width=" 600 "/ >


Create a new host and use the proxy you just created to collect it.

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/EfhW4MMJ/BhICL.jpg "alt=" bhicl.jpg "height=" 526 "width=" 600 "/>


5. View the proxy log

If there is any problem during the deployment process, be sure to look at the log more.

[[email protected] ~]# tail -f /var/log/zabbix/zabbix_proxy.log    2156:20141130:151725.403 proxy  #17  started [http poller  #1]   2158:20141130:151725.407 proxy  #19  started [history syncer  #1]   2159:20141130:151725.409 proxy  #20  started [history syncer  #2]   2137:20141130:151725.410 received configuration data from server, datalen  7294  2160:20141130:151725.419 proxy  #21  started [history syncer  #3]   2161:20141130:151725.423 proxy  #22  started [history syncer  #4]   2162:20141130:151725.427 proxy  #23  started [self-monitoring  #1]   2157:20141130:151725.645 proxy  #18  started [discoverer  #1]   2140:20141130:151730.648 enabling zabbix agent checks on host  "client-active":  host became available 


6. Server View status :

You can see that the agent status of the host is already available.

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efi8pD0Y/UqVK4.jpg "alt=" uqvk4.jpg "height=" "width=" 600 "/>


Status of the agent,

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efi8C9K8/UwR2S.jpg "alt=" uwr2s.jpg "height=" 178 "width=" 600 "/>



b) Proxy passive mode

Passive mode: The server enables the proxy polling process, which periodically obtains data from the passive agent.

Common application scenarios such as: Server can not expose the port, proxy can expose the port.

In passive mode, the time that the configuration is retrieved, the frequency at which the data is sent is defined by the server:


1. Start the agent polling process in server

#192.168.188.30# The agent polling process on the server, configuring the refresh time sent to the agent, the time interval to collect data from the agent sed-i ' s/.*startproxypollers=.*$/startproxypollers=5/' /etc/zabbix/zabbix_server.conf sed-i ' s/.*proxyconfigfrequency=.*/proxyconfigfrequency=300/'/etc/zabbix/zabbix_ server.conf sed-i ' s/.*proxydatafrequency=.*/proxydatafrequency=3/'/etc/zabbix/zabbix_server.conf/etc/init.d/ Zabbix-server restart


       2. The main configuration of proxy is as follows

#192.168.188.32# in Proxy modify hostname sed -i  ' s/hostname=.*/hostname=proxy-pass/'  /etc/sysconfig/ Networkhostname proxy-pass# can find that the configuration of passive agents and active agents is 3 fewer parameters:, is to be configured in server. cat > /etc/zabbix/zabbix_proxy.conf <<eofproxymode=1                               #这个配置为1时, the agent becomes passive proxy mode, which defaults to 0 active proxy mode. server=192.168.188.30                    #填写Server的IP, Proxy will send the collected data to this iphostnameitem=system.hostname              logfile=/var/log/zabbix/zabbix_proxy.loglogfilesize= 0pidfile=/var/run/zabbix/zabbix_proxy.piddbname=zabbix_proxydbuser=zabbixdbpassword=zabbixdbsocket=/var/lib/ mysql/mysql.sockproxylocalbuffer=0                       #当数据发送到Server and how many hours are reserved locally. proxyofflinebuffer=1     not retained                 #当数据没有发送到Server, How many hours, 3 hours, are reserved locally. Externalscripts=/usr/lib/zabbix/externalscriptseof


3. Configure the client Pass

 #192.168.188.34# first modify the hostname client-active ' sed -i  in s/HOSTNAME=.*/ hostname=client-pass/'  /etc/sysconfig/networkhostname client-passyum install zabbix-agent  -ysed -i  ' s/server=.*/server=192.168.188.32/'  /etc/zabbix/zabbix_agentd.conf                #这里的ServerIP要填写oroxy-active's sed - i  ' s/serveractive=.*/serveractive=192.168.188.32/'  /etc/zabbix/zabbix_agentd.conf  # The ServerIP here is .sed -i  ' s/^hostname=\ (. *\)/#Hostname =\1/'  /etc/zabbix/zabbix_ for agent (active) mode agentd.conf                # The default static host name is commented sed -i  ' s/.*hostnameitem=\ (. *\)/hostnameitem=\1/'  /etc/zabbix/zabbix_agentd.conf          #使用内部key来获取动态的主机名/etc/init.d/zabbix-agent startchkconfig  zabbix-agent on 



4. Configure on the server Web :

When creating a new agent, change the proxy mode to passive and add the IP of the passive proxy

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efin7fiV/EFPhr.jpg "alt=" efphr.jpg "height=" 417 "width=" 600 "/>



Create a new host and use the proxy you just created to collect it.

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efin7AVr/qiHIR.jpg "alt=" qihir.jpg "height=" 513 " Width= "/>"


5. View the proxy log

The last line of the log can see that Client-pass has been successfully collected, where the ' cannot send list of active checks to ' is not an error, and the latter agent (active) will speak.

[[email protected] create]# tail -f /var/log/zabbix/zabbix_proxy.log   1944:20141130:154643.633 cannot send list of active checks to [ 192.168.188.34]: host [client-pass] not found  1946:20141130:154827.798  received configuration data from server, datalen 2588   1943:20141130:154844.084 cannot send list of active checks to [ 192.168.188.34]: host [client-pass] not found  1942:20141130:155044.404  cannot send list of active checks to [192.168.188.34]: host [ Client-pass] not found  1945:20141130:155243.827 cannot send list of  active checks to [192.168.188.34]: host [client-pass] not found   1942:20141130:155449.152 cannot send&nbsP;list of active checks to [192.168.188.34]: host [client-pass] not  found  1945:20141130:155557.355 cannot send list of active  checks to [192.168.188.34]: host [client-pass] not found   1945:20141130:155649.490 cannot send list of active checks to [ 192.168.188.34]: host [client-pass] not found  1944:20141130:155829.609  received configuration data from server, datalen 7324   1937:20141130:155835.557 enabling zabbix agent checks on host  "Client-pass" :  host became available


6. Server View status :

You can see that two hosts are collected by different agents and are available

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efiqjjau/4MJiR.jpg "alt=" 4mjir.jpg "height=" 209 "width=" 600 "/>


to view the status of an agent ~

650) this.width=650; "src=" http://pic.yupoo.com/kinda22/Efiq77xF/WVvSy.jpg "alt=" wvvsy.jpg "height=" "width=" 600 "/>



This article is from the "Xiaofeng Moon" blog, make sure to keep this source http://kinda22.blog.51cto.com/2969503/1584668

"Learn Zabbix with Me" 1.1 Zabbix Proxy (primary/deployed)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.