{"id":1563,"date":"2023-03-25T17:35:50","date_gmt":"2023-03-25T09:35:50","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1563"},"modified":"2023-04-27T21:35:05","modified_gmt":"2023-04-27T13:35:05","slug":"zabbix-agentd-deployment-record-under-centos","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/zabbix-agentd-deployment-record-under-centos\/","title":{"rendered":"CentOS\u4e0bZabbix Agentd\u90e8\u7f72\u8bb0\u5f55"},"content":{"rendered":"<h2>Zabbix agentd\u5b89\u88c5\u8fd0\u884c<\/h2>\n<h3>\u521b\u5efazabbix\u7528\u6237<\/h3>\n<pre><code>groupadd zabbix\nuseradd -g zabbix -M -s \/sbin\/nologin zabbix<\/code><\/pre>\n<p><!-- more --><\/p>\n<h3>\u5b89\u88c5zabbix_agentd<\/h3>\n<pre><code># tar -zxf zabbix-4.2.5.tar.gz\n# cd zabbix-4.2.5\/\n# .\/configure --prefix=\/usr\/local\/zabbix --enable-agent\n# make &amp; make install\n# \/usr\/local\/zabbix\/sbin\/zabbix_agentd --version<\/code><\/pre>\n<h3>\u914d\u7f6eagent\u6587\u4ef6<\/h3>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<pre><code>LogFile=\/tmp\/zabbix_agentd.log\nServer=192.168.16.30    # Zabbix Server IP ( \u88ab\u52a8\u6a21\u5f0f\uff0c\u5ba2\u6237\u7aef\u88ab\u52a8 )\nListenPort=10050    # agent\u76d1\u542c\u7aef\u53e3\nStartAgents=3\n#ServerActive=127.0.0.1    # \u4e3b\u52a8\u6a21\u5f0f\uff0c\u5982\u679c\u4f7f\u7528\u4e5f\u586b Zabbix Server IP \uff0c\u4e0d\u4f7f\u7528\u53ef\u4ee5\u6ce8\u91ca\u6389\nHostname=192.168.16.31    # \u672c\u8eab IP\uff0cZabbix Server \u6dfb\u52a0\u4e3b\u673a\u65f6\u9700\u8981\u4f7f\u7528\uff0c\u4e0d\u4e00\u5b9a\u662f IP \n#Include=\/usr\/local\/zabbix_agent\/etc\/zabbix_agentd.conf.d\/*.conf      # \u52a0\u8f7d\u81ea\u5b9a\u4e49\u7684\u76d1\u63a7\u914d\u7f6e\u6587\u4ef6\nTimeout=30\nUnsafeUserParameters=1    # \u5141\u8bb8\u81ea\u5b9a\u4e49 Key<\/code><\/pre>\n<h2>\u5f00\u653e\u901a\u4fe1\u7aef\u53e3<\/h2>\n<pre><code># firewall-cmd --permanent --add-port=10050\/tcp\n# firewall-cmd --reload<\/code><\/pre>\n<pre><code># iptables -A INPUT -s &#039;Zabbix Server IP&#039; -p tcp --dport 10050 -j ACCEPT    # \u7531\u4e8e\u662f\u5ba2\u6237\u7aef\u88ab\u52a8\u6a21\u5f0f\uff0c\u6240\u4ee5\u8981\u5f00\u653e\u7aef\u53e3\u4f9b Zabbix Server \u8fde\u63a5\n\n#\u4e5f\u53ef\u76f4\u63a5\u7f16\u8f91\/etc\/sysconfig\/iptables    \u6dfb\u52a0\uff1a-A INPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT\n# service iptables restart<\/code><\/pre>\n<h2>\u542f\u52a8\u670d\u52a1<\/h2>\n<p>\uff081\uff09\u666e\u901a\u542f\u52a8<\/p>\n<pre><code># \/usr\/local\/zabbix\/sbin\/zabbix_agentd -c \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<p>\uff082\uff09\u670d\u52a1\u542f\u52a8\uff08\u63a8\u8350\uff09<\/p>\n<pre><code># cp zabbix-4.2.5\/misc\/init.d\/fedora\/core\/zabbix_agentd \/etc\/init.d\/\n# vim \/etc\/init.d\/zabbix_agentd\n\n        # Zabbix-Directory\n        BASEDIR=\/usr\/local\/zabbix<\/code><\/pre>\n<pre><code># \/etc\/init.d\/zabbix_agentd start\n# \/etc\/init.d\/zabbix_agentd restart<\/code><\/pre>\n<h2>zabbix agent\u7684\u4e3b\u52a8\u6a21\u5f0f\u4e0e\u88ab\u52a8\u6a21\u5f0f\u53cazabbix proxy<\/h2>\n<h3>zabbix agent\u4e3b\u52a8\u6a21\u5f0f\u4e0e\u88ab\u52a8\u6a21\u5f0f\u7684\u533a\u522b<\/h3>\n<p>zabbix agent\u7684\u8fd0\u884c\u6a21\u5f0f\u6709\u4ee5\u4e0b\u4e24\u79cd\uff1a<\/p>\n<p>\uff081\uff09\u88ab\u52a8\u6a21\u5f0f\uff1a\u6b64\u6a21\u5f0f\u4e3azabbix\u9ed8\u8ba4\u7684\u5de5\u4f5c\u6a21\u5f0f\uff0c\u7531zabbix server \u5411zabbix agent \u53d1\u51fa\u6307\u4ee4\u83b7\u53d6\u6570\u636e\uff0czabbix agent\u88ab\u52a8\u5730\u53bb\u83b7\u53d6\u6570\u636e\u5e76\u8fd4\u56de\u7ed9zabbix server\uff0czabbix server\u4f1a\u5468\u671f\u6027\u5730\u5411agent\u7d22\u53d6\u6570\u636e\u3002\u6b64\u6a21\u5f0f\u7684\u6700\u5927\u95ee\u9898\u5c31\u662f\u4f1a\u589e\u52a0zabbix server\u7684\u5de5\u4f5c\u91cf\uff0c\u5728\u5927\u91cf\u7684\u670d\u52a1\u5668\u73af\u5883\u4e0b\uff0czabbix server\u4e0d\u80fd\u53ca\u65f6\u83b7\u53d6\u5230\u6700\u65b0\u7684\u6570\u636e\u3002<br \/>\n\uff082\uff09\u4e3b\u52a8\u6a21\u5f0f\uff1a\u5373\u7531zabbix agent \u4e3b\u52a8\u91c7\u96c6\u6570\u636e\u5e76\u8fd4\u56de\u7ed9zabbix server\uff0c\u4e0d\u9700\u8981zabbix server \u7684\u53e6\u884c\u5e72\u9884\uff0c\u56e0\u6b64\u4f7f\u7528\u4e3b\u52a8\u6a21\u5f0f\u80fd\u5728\u4e00\u5b9a\u7a0b\u5e8f\u4e0a\u51cf\u8f7bzabbix server\u7684\u538b\u529b\u3002<\/p>\n<h3>\u4ee5\u4e3b\u52a8\u6a21\u5f0f\u90e8\u7f72zabbix_agent\u5e76\u4f7f\u7528zabbix server\u8fdb\u884c\u76d1\u63a7<\/h3>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf\n# \/usr\/local\/zabbix\/sbin\/zabbix_agentd -c \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<pre><code>LogFile=\/tmp\/zabbix_agentd.log\nServer=192.168.16.30    #\u88ab\u52a8\u6a21\u5f0f\u6240\u63a5\u53d7\u7684\u670d\u52a1\u5668Ip\uff0c\u6b64\u5904\u662f\u4e3a\u4e86\u542f\u7528\u76d1\u542c10050\u7aef\u53e3\uff0c\u4ece\u800c\u76d1\u6d4b\u5230zabbix\u4e3b\u673a\u7684zbx\u72b6\u6001\u3002\nListenPort=10050\nStartAgents=1    #\u9ed8\u8ba4\u542f\u52a8\u7684zabbix_agentd pre-fork\u8fdb\u7a0b\uff0c\u5982\u679c\u4e3a0\u7684\u8bdd\u8868\u793a\u505c\u7528\u88ab\u52a8\u6a21\u5f0f\nServerActive=192.168.16.30    #\u4e3b\u52a8\u6a21\u5f0f\u7684\u670d\u52a1\u5668IP\nHostname=Zabbix-Node-31\nTimeout=30\nUnsafeUserParameters=1    # \u5141\u8bb8\u81ea\u5b9a\u4e49 Key<\/code><\/pre>\n<p>\uff081\uff09\u5728zabbix server\u4e0a\u6dfb\u52a0\u76f8\u5e94\u7684zabbix \u4e3b\u673a\uff1a<code>Configuration<\/code> -&gt; <code>Hosts<\/code> -&gt; <code>Create host<\/code>(\u53f3\u4e0a\u89d2) -&gt; \u9ed8\u8ba4<code>Host<\/code>\u9009\u9879\u5361 -&gt; \u6ce8\u610f<code>Host name<\/code>\u8981\u4e0e<code>zabbix_agentd.conf<\/code>\u4e2d\u914d\u7f6e\u7684\u4e00\u81f4 -&gt; <code>Add<\/code> or <code>Update<\/code> -&gt; <code>Reset<\/code><\/p>\n<p>\uff082\uff09\u6dfb\u52a0\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<p>\uff083\uff09\u6216\u8bbe\u7f6e\u81ea\u52a8\u53d1\u73b0\uff1a\u914d\u7f6e<code>Configuration<\/code> -&gt; <code>Discovery<\/code>\uff0c\u5df2\u53d1\u73b0<code>Monitoring<\/code> -&gt; <code>Discovery<\/code><\/p>\n<h3>\u4ee5\u88ab\u52a8\u6a21\u5f0f\u90e8\u7f72zabbix_agent\u5e76\u4f7f\u7528zabbix server\u8fdb\u884c\u76d1\u63a7<\/h3>\n<p>\u88ab\u52a8\u6a21\u5f0f\u7684\u90e8\u7f72\u65b9\u5f0f\u6bd4\u4e3b\u52a8\u6a21\u5f0f\u7b80\u5355\uff0c\u56e0\u4e3a\u5176\u672c\u8eab\u5c31\u662fzabbix agent\u7684\u9ed8\u8ba4\u5de5\u4f5c\u6a21\u5f0f\u3002<\/p>\n<pre><code># vim \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf\n# \/usr\/local\/zabbix\/sbin\/zabbix_agentd -c \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf<\/code><\/pre>\n<pre><code>LogFile=\/tmp\/zabbix_agentd.log\nServer=192.168.16.30\nListenPort=10050\nStartAgents=5\n#ServerActive=192.168.16.30   #\u6ce8\u91ca\u6389\u4e3b\u52a8\u6a21\u5f0f\u7684\u914d\u7f6e\nHostname=192.168.16.32\nTimeout=30\nUnsafeUserParameters=1<\/code><\/pre>\n<p>\uff081\uff09\u5728zabbix server\u4e0a\u6dfb\u52a0\u76f8\u5e94\u7684zabbix \u4e3b\u673a\uff1a<code>Configuration<\/code> -&gt; <code>Hosts<\/code> -&gt; <code>Create host<\/code>(\u53f3\u4e0a\u89d2) -&gt; \u9ed8\u8ba4<code>Host<\/code>\u9009\u9879\u5361 -&gt; \u6ce8\u610f<code>Host name<\/code>\u8981\u4e0e<code>zabbix_agentd.conf<\/code>\u4e2d\u914d\u7f6e\u7684\u4e00\u81f4 -&gt; <code>Add<\/code> or <code>Update<\/code> -&gt; <code>Reset<\/code><\/p>\n<p>\uff082\uff09\u6dfb\u52a0\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<p>\uff083\uff09\u6216\u8bbe\u7f6e\u81ea\u52a8\u53d1\u73b0\uff1a\u914d\u7f6e<code>Configuration<\/code> -&gt; <code>Discovery<\/code>\uff0c\u5df2\u53d1\u73b0<code>Monitoring<\/code> -&gt; <code>Discovery<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zabbix agentd\u5b89\u88c5\u8fd0\u884c \u521b\u5efazabbix\u7528\u6237 groupadd zabbix useradd -g [&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-1563","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\/1563","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=1563"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1563\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}