{"id":103690,"date":"2024-09-04T10:59:13","date_gmt":"2024-09-04T02:59:13","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=103690"},"modified":"2024-09-04T10:59:13","modified_gmt":"2024-09-04T02:59:13","slug":"zabbix-agent-client","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zabbix-agent-client.html","title":{"rendered":"Zabbix Agent Source compilation installation"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nZabbix Agent \u5b89\u88c5\u5728\u8fdc\u7a0b\u7cfb\u7edf\u4e0a\uff0c\u9700\u8981\u901a\u8fc7Zabbix\u670d\u52a1\u5668\u8fdb\u884c\u76d1\u63a7\u3002Zabbix Agent\u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\u6536\u96c6\u8d44\u6e90\u5229\u7528\u548c\u5e94\u7528\u7a0b\u5e8f\u6570\u636e\uff0c\u5e76\u5411Zabbix\u670d\u52a1\u5668\u63d0\u4f9b\u8fd9\u4e9b\u4fe1\u606f\u3002Zabbix\u652f\u6301Ping\uff0cZBX\u3001SNMP\u3001JMX\u3001IPMI\u7b49\u76d1\u63a7\u65b9\u5f0f\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

1.\u5b89\u88c5\u6269\u5c55\u5305\u4ee5\u53ca\u4f9d\u8d56\u5305<\/p>\n

\r\n$ yum -y install epel-release\r\n$ yum install pcre pcre-devel openssl openssl-devel -y\r\n<\/pre>\n

2.\u6dfb\u52a0Zabbix\u7528\u6237\u548c\u7ec4<\/p>\n

\r\n$ groupadd zabbix\r\n$ useradd zabbix -g zabbix -s \/sbin\/nologin\r\n<\/pre>\n

3.\u5b89\u88c5Zabbix-Agent<\/p>\n

\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/www.zabbix.com\/download<\/p>\n

\r\n$ cd \/tmp\r\n$ tar -zxvf zabbix-3.4.2.tar.gz\r\n$ cd zabbix-3.4.2\r\n$ .\/configure --prefix=\/usr\/local\/zabbix --enable-agent --with-mysql --with-openssl\r\n$ make && make install\r\n<\/pre>\n

4.\u521b\u5efaZabbix\u65e5\u5fd7\u76ee\u5f55\u5e76\u751f\u6210\uff08PSK\uff09\u5bc6\u94a5<\/p>\n

\r\n$ mkdir -p \/usr\/local\/zabbix\/logs\/\r\n$ chown -R zabbix.zabbix \/user\/local\/zabbix\r\n$ sh -c \"openssl rand -hex 32 > \/usr\/local\/zabbix\/etc\/zabbix_agentd.psk\"\r\n$ cat \/usr\/local\/zabbix\/etc\/zabbix_agentd.psk\r\nfd1ac849e5f787dfc04300ae997d158e6f6f0c2209d66e7d2e687da2032ecbae\r\n<\/pre>\n

5.\u914d\u7f6ezabbix_agentd.conf<\/p>\n

\u4ee5\u4e0b\u662f\u914d\u7f6e\u5b8c\u6210\u540e\u7684\u5185\u5bb9\uff1a<\/p>\n

\r\n$ egrep -v \"(^#|^$)\" \/usr\/local\/zabbix\/etc\/zabbix_agentd.conf\r\n\r\nEnableRemoteCommands=1 #\u6765\u81f3zabbix\u670d\u52a1\u5668\u7684\u8fdc\u7a0b\u547d\u4ee4\u662f\u5426\u5141\u8bb8\u88ab\u6267\u884c\r\nPidFile=\/usr\/local\/zabbix\/zabbix_agentd.pid\r\nLogFile=\/usr\/local\/zabbix\/logs\/zabbix_agentd.log\r\nServer=10.10.204.65 #Zabbix Server IP \u5730\u5740\r\nServerActive=10.10.204.65 #\u5730\u5740\u540c\u4e0a \u4e3b\u52a8\u5411 Zabbix Server \u53d1\u9001\u76d1\u63a7\u5185\u5bb9\r\nHostname=101020465 #\u672c\u673a\u4e3b\u673a\u540d \u5185\u5bb9\u8981\u548cZabbix Server \u914d\u7f6e\u7684 Host Name \u4e00\u81f4\r\nHostMetadataItem=system.uname #\u7528\u4e8eItem\u83b7\u53d6\u6570\u636e\r\nUser=zabbix\r\nUnsafeUserParameters=1 #\u662f\u5426\u542f\u7528\u81ea\u5b9a\u4e49key,zabbix\u76d1\u63a7mysql\u3001tomcat\u7b49\u6570\u636e\u65f6\u9700\u8981\u81ea\u5b9a\u4e49key\r\n#\u4e0b\u9762\u4f7f\u7528\u9884\u5171\u4eab\u5bc6\u94a5\uff08PSK\uff09\u6765\u4fdd\u62a4\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u4e4b\u95f4\u7684\u8fde\u63a5\r\nTLSConnect=psk\r\nTLSAccept=psk\r\nTLSPSKIdentity=PSK 001\r\nTLSPSKFile=\/usr\/local\/zabbix\/etc\/zabbix_agentd.psk\r\n<\/pre>\n

\u6ce8\u610f\uff1a\u5173\u4e8e\u66f4\u591aAgent\u914d\u7f6e\u53c2\u6570\u4f18\u5316\uff0c\u8bf7\u53c2\u9605\u8fd9\u91ccZabbix agent (UNIX)\u3002<\/p>\n

6.\u521b\u5efasystemctl\u7cfb\u7edfZabbix agent \u5355\u5143\u6587\u4ef6<\/p>\n

\r\n$ vim \/usr\/lib\/systemd\/system\/zabbix-agent.service\r\n\r\n[Unit]\r\nDescription=Zabbix Agent\r\nAfter=syslog.target\r\nAfter=network.target\r\n\r\n[Service]\r\nEnvironment=\"CONFFILE=\/usr\/local\/zabbix\/etc\/zabbix_agentd.conf\"\r\n#EnvironmentFile=\/usr\/local\/zabbix\/etc\/zabbix_agentd.conf.d\/\r\nType=forking\r\nRestart=on-failure\r\n#PIDFile=\/tmp\/zabbix_agentd.pid\r\nKillMode=control-group\r\nExecStart=\/usr\/local\/zabbix\/sbin\/zabbix_agentd -c $CONFFILE\r\nExecStop=\/bin\/kill -SIGTERM $MAINPID\r\nRestartSec=10s\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\n

7.\u542f\u52a8 Zabbix Agentd \u5ba2\u6237\u7aef\u670d\u52a1\u5e76\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n

\r\n$ systemctl start zabbix-agent\r\n$ systemctl enable zabbix-agent\r\n<\/pre>\n

8.\u8bbe\u7f6e Firewalld \u9632\u706b\u5899<\/p>\n

\r\n$ firewall-cmd --permanent --add-port=10050\/tcp\r\n$ firewall-cmd --reload\r\n<\/pre>\n

\u5df2\u7ecf\u5b8c\u6210 Zabbix Agent \u7684\u5b89\u88c5\u3002\u540e\u671f\u6211\u8fd8\u4f1a\u5199\u4e00\u4e9b\u5173\u4e8ezabbix\u7684\u4f7f\u7528\u4ee5\u53ca\u4f18\u5316\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/538<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/zabbix-agent-client.html<\/a>\u7f16\u8f91\uff1a\u5434\u5411\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Zabbix Agent \u5b89\u88c5\u5728\u8fdc\u7a0b\u7cfb\u7edf\u4e0a\uff0c\u9700\u8981\u901a\u8fc7Zabbix\u670d\u52a1\u5668\u8fdb\u884c\u76d1\u63a7\u3002Zabbix Agent […]<\/p>\n","protected":false},"author":668,"featured_media":23337,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-103690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=103690"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103690\/revisions"}],"predecessor-version":[{"id":292852,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103690\/revisions\/292852"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/23337"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=103690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=103690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=103690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}