{"id":748,"date":"2022-06-27T17:17:02","date_gmt":"2022-06-27T09:17:02","guid":{"rendered":"http:\/\/www.rchen.top\/?p=748"},"modified":"2022-06-27T17:17:06","modified_gmt":"2022-06-27T09:17:06","slug":"zabbix-agent%e6%97%a0%e6%b3%95%e6%b3%a8%e5%86%8c%e5%90%84%e7%a7%8d%e9%97%ae%e9%a2%98%e6%8e%92%e6%9f%a5%e6%80%9d%e8%b7%af","status":"publish","type":"post","link":"https:\/\/www.rchen.top\/?p=748","title":{"rendered":"zabbix-agent\u65e0\u6cd5\u6ce8\u518c\u5404\u79cd\u95ee\u9898\u6392\u67e5\u601d\u8def"},"content":{"rendered":"<p><b>\u901a\u7528\u95ee\u9898\u89e3\u51b3\uff1a<\/b><\/p>\n<p>1\u3001\u68c0\u67e5\u662f\u5426\u5173\u95ed\u9632\u706b\u5899\u53caselinux<br \/>\nsystemctl stop firewalld.service<br \/>\nsystemctl disable firewalld.service<br \/>\nsetenforce 0<\/p>\n<p>2\u3001\u67e5\u770b\u670d\u52a1\u662f\u5426\u542f\u52a8<\/p>\n<p>systemctl status zabbix-agent<\/p>\n<p>3\u3001\u67e5\u770b\u670d\u52a1\u7aef\u4e0e\u5ba2\u6237\u7aef\u7aef\u53e310050\u662f\u5426\u8fde\u901a\uff0c\u68c0\u67e5iptables<\/p>\n<p>netstat -antp<\/p>\n<p>iptables -L -n<\/p>\n<p>4\u3001\u901a\u8fc7\u65e5\u5fd7\u8bca\u65ad\uff1b<\/p>\n<p>5\u3001\u7f51\u7edc\u662f\u5426\u53ef\u8fbe\uff0c10050\uff0c10051\u8fd9\u4e9b\u7aef\u53e3\u662f\u5426\u963b\u585e\uff1b<\/p>\n<p><b>\u73b0\u8c61<\/b><b>1<\/b><b>\uff1a<\/b><\/p>\n<p><b>\u6839\u636e\u65e5\u5fd7\u67e5\u770b\u5206\u6790\uff0c\u662f\u7531\u4e8e\u7cfb\u7edf\u6743\u9650\u95ee\u9898\uff0c\u5173\u95ed<\/b>setenforce\u5373\u53ef<\/p>\n<p>cat \/var\/log\/zabbix\/zabbix_agentd.log<\/p>\n<p>2660:20200423:195520.197 Starting Zabbix Agent [kingdeetest-10.100.7.34]. Zabbix 3.2.9 (revision 73587).<\/p>\n<p>2660:20200423:195520.198 **** Enabled features ****<\/p>\n<p>2660:20200423:195520.201 IPv6 support:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 YES<\/p>\n<p>2660:20200423:195520.203 TLS support:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 YES<\/p>\n<p>2660:20200423:195520.206 **************************<\/p>\n<p>2660:20200423:195520.207 using configuration file: \/etc\/zabbix\/zabbix_agentd.conf<\/p>\n<p>2660:20200423:195520.208 cannot set resource limit: [13] Permission denied<\/p>\n<p>2660:20200423:195520.210 cannot disable core dump, exiting\u2026<\/p>\n<p>\u4e00\u822c\u662f\u672a\u5173\u95edselinux<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5 setenforce 0<\/p>\n<p><b>\u73b0\u8c61<\/b><b>2<\/b><b>\uff1a<\/b><\/p>\n<p>zabbix_agentd [28973]: cannot create PID file [\/var\/run\/zabbix\/zabbix_agentd.pid]: [2] No such file or directory<\/p>\n<p>Fresh install of zabbix22-agent fails to start because the agent cannot create its PID file.<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5:<\/p>\n<p>[root@zabbix-agent1 run]# mkdir zabbix<\/p>\n<p>[root@zabbix-agent1 run]# ls -ld zabbix<\/p>\n<p>drwxr-xr-x 2 root root 40 6\u6708\u00a0 27 22:33 zabbix\u00a0 \/\/\u53d1\u73b0\u6240\u5c5e\u4e3b\u6240\u5c5e\u7ec4\u662froot<\/p>\n<p>[root@zabbix-agent1 run]# <b>chown zabbix.zabbix zabbix<\/b><\/p>\n<p>[root@zabbix-agent1 run]# ls -ld zabbix<\/p>\n<p>drwxr-xr-x 2 zabbix zabbix 40 6\u6708\u00a0 27 22:33 zabbix\u00a0 \/\/\u6b64\u65f6\u5df2\u7ecf\u53ef\u4ee5\u542f\u52a8agent\u4e86\uff0c\u5982\u679c\u4f9d\u7136\u4e0d\u884c\uff0c\u5219\u8fdb\u884c\u4e0b\u9762\u64cd\u4f5c<\/p>\n<p>[root@zabbix-agent1 run]# chmod g+w zabbix\/\u00a0\u00a0\u00a0 \/\/\u7ed9\u6240\u5c5e\u7ec4\u6dfb\u52a0\u8bfb\u6743\u9650<\/p>\n<p>[root@zabbix-agent1 run]# ls -ld zabbix<\/p>\n<p>drwxrwxr-x 2 zabbix zabbix 40 6\u6708\u00a0 27 22:33 zabbix<\/p>\n<p>[root@zabbix-agent1 run]# touch zabbix\/zabbix_agentd.pid<\/p>\n<p>[root@zabbix-agent1 zabbix]# systemctl restart zabbix-agent<\/p>\n<p>[root@zabbix-agent1 zabbix]# systemctl status zabbix-agent<\/p>\n<ul>\n<li>zabbix-agent.service &#8211; LSB: Start and stop Zabbix agent<\/li>\n<\/ul>\n<p>Loaded: loaded (\/etc\/rc.d\/init.d\/zabbix-agent; bad; vendor preset: disabled)<\/p>\n<p>Active: active (running) since \u4e8c 2017-06-27 22:37:21 CST; 1s ago<\/p>\n<p>&#8230;&#8230;<\/p>\n<p><b>\u73b0\u8c61<\/b><b>3<\/b><b>\uff1a<\/b><\/p>\n<p>zabbix agent\u5728Windows\u4e0b\u5b89\u88c5\u62a5[8576]:ERROR:cannot connect to Service Manager:[0x00000005]\u9519\u8bef\u7684\u89e3\u51b3<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"50\" class=\"alignnone wp-image-749 size-full\" src=\"http:\/\/www.rchen.top\/wp-content\/uploads\/2022\/06\/Pasted-57.png\" \/><\/p>\n<p>\u4f7f\u7528\u7ba1\u7406\u5458\u6a21\u5f0f\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u6216\u547d\u4ee4\u5373\u53ef<\/p>\n<p>C:\\Windows\\system32&gt;C:\\zabbix\\zabbix_agentd.exe -i -c C:\\zabbix\\zabbix_agentd.win.conf<\/p>\n<p>zabbix_agentd.exe [191648]: service [Zabbix Agent] installed successfully<\/p>\n<p>zabbix_agentd.exe [191648]: event source [Zabbix Agent] installed successfully<\/p>\n<p>C:\\Windows\\system32&gt;C:\\zabbix\\zabbix_agentd.exe -s -c C:\\zabbix\\zabbix_agentd.win.conf<\/p>\n<p>zabbix_agentd.exe [193100]: service [Zabbix Agent] started successfully<\/p>\n<p>C:\\Windows\\system32&gt;C:\\zabbix\\zabbix_agentd.exe &#8211;stop<\/p>\n<p>zabbix_agentd.exe [193600]: service [Zabbix Agent] stopped successfully<\/p>\n<p>C:\\Windows\\system32&gt;C:\\zabbix\\zabbix_agentd.exe &#8211;start<\/p>\n<p>zabbix_agentd.exe [194464]: service [Zabbix Agent] started successfully<\/p>\n<p>C:\\Windows\\system32&gt;PAUSE<\/p>\n<p>Press any key to continue . . .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u7528\u95ee\u9898\u89e3\u51b3\uff1a 1\u3001\u68c0\u67e5\u662f\u5426\u5173\u95ed\u9632\u706b\u5899\u53caselinux systemctl stop firewalld.se [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":698,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[134],"tags":[102],"class_list":["post-748","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-134","tag-zabbix"],"_links":{"self":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=748"}],"version-history":[{"count":1,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":750,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions\/750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/media\/698"}],"wp:attachment":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}