{"id":1564,"date":"2023-03-25T17:37:16","date_gmt":"2023-03-25T09:37:16","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1564"},"modified":"2023-04-27T21:34:57","modified_gmt":"2023-04-27T13:34:57","slug":"zabbix-proxy-deployment-record-under-centos","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/zabbix-proxy-deployment-record-under-centos\/","title":{"rendered":"CentOS\u4e0bZabbix Proxy\u90e8\u7f72\u8bb0\u5f55"},"content":{"rendered":"<h2>Zabbix Proxy<\/h2>\n<p>zabbix\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u76d1\u63a7\u7cfb\u7edf\uff0c\u5176\u652f\u6301\u901a\u8fc7\u4ee3\u7406\u670d\u52a1\u5668zabbix proxy \u6765\u6536\u96c6zabbix agent\u7684\u6570\u636e\uff0c\u7136\u540ezabbix proxy\u518d\u628a\u6536\u96c6\u4fdd\u5b58\u5728\u672c\u5730\u6570\u636e\u5e93\u7684\u6570\u636e\u9001\u5f80zabbix server\u8fdb\u884c\u7edf\u4e00\u5b58\u50a8\u548c\u5c55\u793a\u3002\u5355\u4e00\u7684zabbix server+ zabbix agent\u7684\u73af\u5883\uff0c\u56e0\u53d7\u9650\u4e8ezabbix server\u6027\u80fd\u74f6\u9888\u7684\u7f18\u6545\uff0c\u5176\u80fd\u7ba1\u63a7\u7684zabbix agent\u662f\u6709\u9650\u7684\u3002\u800czabbix proxy\u5219\u628azabbix server\u4ece\u6536\u96c6\u6570\u636e\u8fd9\u4e00\u529f\u80fd\u4e2d\u62bd\u79bb\u51fa\u6765\uff0c\u4f7f\u5f97zabbix server\u4e13\u6ce8\u4e8e\u5bf9\u6570\u636e\u8fdb\u884c\u5b58\u50a8\u548c\u5c55\u793a\uff0c\u63d0\u5347\u4e86zabbix server\u6240\u80fd\u7ba1\u63a7\u7684zabbix agent\u6570\u636e\u53ca\u63d0\u9ad8\u4e86\u90e8\u7f72\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u65b0\u589ezabbix proxy\u670d\u52a1\u5668\uff0c\u4fee\u6539\u4e4b\u524d\u90e8\u7f72\u914d\u7f6e\u7684zabbix server\u548cagent\u6765\u8c03\u7528zabbix proxy\u670d\u52a1\u5668\uff0c\u4ece\u800c\u8ba9zabbix server \u4ecezabbix proxy\u4e0a\u83b7\u53d6\u5176\u6536\u96c6\u5230\u7684zabbix agent\u6570\u636e\u3002<\/p>\n<h2>\u521b\u5efaZabbix\u7528\u6237<\/h2>\n<pre><code>groupadd zabbix\nuseradd -g zabbix -M -s \/sbin\/nologin zabbix<\/code><\/pre>\n<h2>\u5b89\u88c5\u4f9d\u8d56<\/h2>\n<pre><code># yum install fping unixODBC OpenIPMI-libs<\/code><\/pre>\n<pre><code># rpm -ivh mysql-community-common-8.0.17-1.el7.x86_64.rpm \n# rpm -ivh mysql-community-libs-8.0.17-1.el7.x86_64.rpm \nwarning: mysql-community-libs-8.0.17-1.el7.x86_64.rpm: Header V3 DSA\/SHA1 Signature, key ID 5072e1f5: NOKEY\nerror: Failed dependencies:\n    mariadb-libs is obsoleted by mysql-community-libs-8.0.17-1.el7.x86_64\n# rpm -qa | grep mariadb\nmariadb-libs-5.5.56-2.el7.x86_64\n# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64\n# rpm -ivh mysql-community-libs-8.0.17-1.el7.x86_64.rpm \n# rpm -ivh mysql-community-devel-8.0.17-1.el7.x86_64.rpm\n# rpm -ivh mysql-community-client-8.0.17-1.el7.x86_64.rpm \n# mysql -V\nmysql  Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)<\/code><\/pre>\n<h2>\u7f16\u8bd1\u5b89\u88c5<\/h2>\n<pre><code># tar -zxf zabbix-4.2.5.tar.gz \n# cd zabbix-4.2.5\/\n# .\/configure --prefix=\/usr\/local\/zabbix --enable-proxy --enable-agent --with-mysql --with-net-snmp=\/usr\/local\/net-snmp\/bin\/net-snmp-config --with-libcurl=\/usr\/local\/curl\/bin\/curl-config --with-libxml2=\/usr\/local\/libxml2\/bin\/xml2-config --with-libevent=\/usr\/local\/libevent\/ --enable-java\n# make &amp; make install<\/code><\/pre>\n<h2>\u6dfb\u52a0\u5e93\u641c\u7d22\u8def\u5f84<\/h2>\n<pre><code># vim \/etc\/ld.so.conf.d\/local.conf\n# ldconfig<\/code><\/pre>\n<pre><code>\/usr\/local\/net-snmp\/lib\n\/usr\/local\/libevent\/lib\n\/usr\/local\/libmcrypt\/lib<\/code><\/pre>\n<pre><code># \/usr\/local\/zabbix\/sbin\/zabbix_proxy -V\nzabbix_proxy (Zabbix) 4.2.5\nRevision 2c0e4d1d39 29 July 2019, compilation time: Aug  1 2019 21:22:21\n\nCopyright (C) 2019 Zabbix SIA\nLicense GPLv2+: GNU GPL version 2 or later &lt;http:\/\/gnu.org\/licenses\/gpl.html&gt;.\nThis is free software: you are free to change and redistribute it according to\nthe license. There is NO WARRANTY, to the extent permitted by law.<\/code><\/pre>\n<h2>\u521b\u5efa\u6570\u636e\u5e93<\/h2>\n<pre><code>> create user &#039;zabbix_proxy&#039;@&#039;192.168.%.%&#039; identified by &#039;zabbix@2019&#039;;\n> create database zabbix_proxy character set utf8 collate utf8_bin;\n> grant all privileges on `zabbix_proxy`.* to &#039;zabbix_proxy&#039;@&#039;192.168.%.%&#039;;\n> flush privileges;<\/code><\/pre>\n<h2>\u5bfc\u5165\u6570\u636e\u5e93<\/h2>\n<pre><code># mysql -uzabbix_proxy -pzabbix@2019 -h192.168.165.239 zabbix_proxy &lt; .\/database\/mysql\/schema.sql<\/code><\/pre>\n<h2>\u7f16\u8f91\u914d\u7f6ezabbix proxy\u7684\u914d\u7f6e\u6587\u4ef6<\/h2>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_proxy.conf<\/code><\/pre>\n<pre><code>ProxyMode=0    #\u6307\u5b9a\u4ee3\u7406\u90a3\u79cd\u6a21\u5f0f\u7684agent\uff0c0\u4e3a\u4e3b\u52a8\u6a21\u5f0f\uff0c1\u4f4d\u88ab\u52a8\u6a21\u5f0f\nServer=192.168.16.30    #zabbix server\u670d\u52a1\u5668\u7684\u5730\u5740\u6216\u4e3b\u673a\u540d\nHostname=HZ_Proxy    #\u4ee3\u7406\u670d\u52a1\u5668\u7684\u540d\u79f0\nLogFile=\/tmp\/zabbix_proxy.log\nDBHost=192.168.16.25    #\u6570\u636e\u5e93\u670d\u52a1\u5668\u5730\u5740\nDBName=zabbix_proxy\nDBUser=zabbix_proxy\nDBPassword=zabbix@2019\nProxyLocalBuffer=3\nProxyOfflineBuffer=24\nHeartbeatFrequency=60    #\u5fc3\u8df3\u95f4\u9694\u68c0\u6d4b\u65f6\u95f4\uff0c\u9ed8\u8ba4\u4e3a60\u79d2\uff0c\u8303\u56f4\u4e3a0-3600\u79d2\uff0c\u88ab\u52a8\u6a21\u5f0f\u4e0d\u4f7f\u7528\nConfigFrequency=5    #\u95f4\u9694\u591a\u4e45\u4ecezabbix server\u83b7\u53d6\u76d1\u63a7\u4fe1\u606f\nDataSenderFrequency=5    #\u6570\u636e\u53d1\u9001\u65f6\u95f4\u95f4\u9694\uff0c\u9ed8\u8ba4\u4e3a1\u79d2\uff0c\u88ab\u52a8\u6a21\u5f0f\u4e0d\u4f7f\u7528\nStartPollers=10    #\u542f\u52a8\u7684\u7ebf\u7a0b\u6570\u636e\uff0c\u5efa\u8bae\u4e0e\u5ba2\u6237\u7aef\u7684\u6570\u91cf\u4fdd\u6301\u4e00\u81f4\nTimeout=30\nLogSlowQueries=3000<\/code><\/pre>\n<h2>\u542f\u52a8zabbix proxy \u670d\u52a1<\/h2>\n<pre><code># \/usr\/local\/zabbix\/sbin\/zabbix_proxy -c \/usr\/local\/zabbix\/etc\/zabbix_proxy.conf<\/code><\/pre>\n<pre><code># ps -ef | grep zabbix_proxy | awk &#039;{print $2}&#039; | xargs kill -9<\/code><\/pre>\n<h2>\u5728zabbix server\u4e0a\u6dfb\u52a0\u4ee3\u7406\u670d\u52a1\u5668<\/h2>\n<p>\uff081\uff09\u6dfb\u52a0proxy\u670d\u52a1\u5668\uff1a<code>Administration<\/code> -&gt; <code>Proxies<\/code> -&gt; <code>Create proxy<\/code>(\u53f3\u4e0a\u89d2) -&gt; <code>Proxy name<\/code>\u586b\u5199\u914d\u7f6e\u7684<code>HZ_Proxy<\/code><\/p>\n<p>\uff082\uff09\u4fee\u6539\u76d1\u63a7\u4e3b\u673a\u7684\u4f7f\u7528\u4ee3\u7406\u76d1\u63a7\uff1a<code>Configuration<\/code> -&gt; <code>Hosts<\/code> -&gt; \u70b9\u51fb\u7f16\u8f91Host -&gt; <code>Host<\/code>\u9009\u9879\u5361\u4e0b<code>Monitored by proxy<\/code>\u4ece<code>(no proxy)<\/code>\u6539\u4e3a<code>HZ_Proxy<\/code><\/p>\n<p>\uff083\uff09\u4fee\u6539\u6b64\u524d\u4e3a\u88ab\u52a8\u6a21\u5f0f\u76d1\u63a7\u7684\u76d1\u63a7\u6a21\u677f\uff1a<code>Templates<\/code>\u9009\u9879\u5361\u4e0b<code>Select<\/code>\u6a21\u677f<code>Template OS Linux<\/code> -&gt; <code>Add<\/code> -&gt; <code>Update<\/code><\/p>\n<h2>\u4fee\u6539zabbxi agent\u7684\u914d\u7f6e<\/h2>\n<p>\u5728192.168.16.31\u4e0a\u4fee\u6539\u5176\u5bf9\u5e94\u7684agent\u914d\u7f6e\uff1a<\/p>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<pre><code>#\u4fee\u6539\u5176server\u548cserveractive\u7684\u914d\u7f6e\u5747\u6307\u5411\u4ee3\u7406\u670d\u52a1\u5668\nServer=192.168.16.33\nServerActive=192.168.16.33<\/code><\/pre>\n<p>\u968f\u540e\u91cd\u542fzabbix agent\u670d\u52a1\uff1a<\/p>\n<pre><code># \/etc\/init.d\/zabbix_agentd restart<\/code><\/pre>\n<p>\u5728192.168.16.32\u4e0a\u4fee\u6539\u5176\u5bf9\u5e94\u7684agent\u914d\u7f6e\uff1a<\/p>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<pre><code>Server=192.168.16.33\nServerActive=192.168.16.33<\/code><\/pre>\n<p>\u968f\u540e\u91cd\u542fzabbix agent\u670d\u52a1\uff1a<\/p>\n<pre><code># \/etc\/init.d\/zabbix_agentd restart<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Zabbix Proxy zabbix\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u76d1\u63a7\u7cfb\u7edf\uff0c\u5176\u652f\u6301\u901a\u8fc7\u4ee3\u7406\u670d\u52a1\u5668zabbix proxy \u6765 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386],"tags":[388],"class_list":["post-1564","post","type-post","status-publish","format-standard","hentry","category-monitor","tag-zabbix"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1564"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1564\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}