{"id":93361,"date":"2024-04-24T15:09:10","date_gmt":"2024-04-24T07:09:10","guid":{"rendered":"http:\/\/gulass.cn\/?p=93361"},"modified":"2024-04-24T15:09:10","modified_gmt":"2024-04-24T07:09:10","slug":"zabbix-port","status":"publish","type":"post","link":"https:\/\/gulass.cn\/zabbix-port.html","title":{"rendered":"\u4f7f\u7528Zabbix\u5b9e\u73b0\u6279\u91cf\u76d1\u63a7\u7aef\u53e3\u72b6\u6001"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u3000\u5728\u76d1\u63a7\u751f\u4ea7\u73af\u5883\u7684\u670d\u52a1\u7684\u65f6\u5019\uff0c\u901a\u5e38\u9700\u8981\u5bf9\u591a\u4e2a\u7aef\u53e3\u8fdb\u884c\u76d1\u63a7\uff0c\u5982\u679c\u6211\u4eec\u624b\u52a8\u4e00\u4e2a\u4e00\u4e2a\u7684\u6dfb\u52a0\uff0c\u8fd9\u5c06\u662f\u4e00\u4ef6\u5f88\u9ebb\u70e6\u7684\u4e8b\u60c5\uff0c\u4e3a\u4e86\u51cf\u5c11\u8fd9\u6837\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u91c7\u7528\u6279\u91cf\u6dfb\u52a0\u76d1\u63a7\u7aef\u53e3\u7684\u65b9\u6cd5\uff0c\u8fd9\u662f\u975e\u5e38\u5e38\u89c1\u7684\u9700\u6c42\uff0czabbix\u4e5f\u662f\u652f\u6301\u8fd9\u79cd\u65b9\u5f0f\u7684\uff0c\u9700\u8981\u4f7f\u7528zabbix\u7684Discovery\u529f\u80fd\u6765\u5b9e\u73b0\uff0c\u4e0b\u9762\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u6279\u91cf\u6dfb\u52a0\u5bf9\u53e3\u7684\u5360\u7528\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4f7f\u7528Zabbix\u76d1\u63a7\u5982\u4f55\u76d1\u63a7\u670d\u52a1\u5668\u7aef\u53e3\u72b6\u6001\uff0c\u5927\u6982\u7684\u6d41\u7a0b\uff1azabbix\u76d1\u63a7\u670d\u52a1\u81ea\u5e26\u7aef\u53e3\u76d1\u63a7\u7684\u76d1\u63a7\u9879\uff0c\u6240\u4ee5\u9700\u8981\u6211\u4eec\u81ea\u5df1\u624b\u52a8\u5b9a\u4e49\u6240\u76d1\u63a7\u7684item\uff0c\u5ba2\u6237\u7aef\u83b7\u53d6\u7684\u7aef\u53e3\u5217\u8868\u901a\u8fc7agent\u4f20\u9001\u5230\u670d\u52a1\u7aef\uff0c<\/p>\n

\u53ea\u9700\u5728\u670d\u52a1\u7aef\u8fdb\u884c\u7aef\u53e3\u76d1\u63a7\u6a21\u677f\u914d\u7f6e\uff0c\u7136\u540e\u81ea\u5b9a\u4e49\u76d1\u63a7\u56fe\u5f62\uff0c\u6dfb\u52a0\u76d1\u63a7\u9879\u5373\u53ef\uff01<\/p>\n

\u4e0b\u9762\u5c31\u6765\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u6279\u91cf\u6dfb\u52a0\u7aef\u53e3\u7684\u65b9\u6cd5\uff01<\/p>\n

\u7b2c\u4e00\uff1a\u81ea\u52a8\u626b\u63cf\u7aef\u53e3\u5e76\u76d1\u63a7\u62a5\u8b66<\/strong><\/div>\n
1.\u7f16\u5199\u811a\u672c\u626b\u63cf\u7aef\u53e3<\/strong><\/span><\/div>\n

\"\"
\n\u811a\u672c\u7684\u4f5c\u7528\u5c31\u662f\u4ece\u88ab\u76d1\u63a7\u7684\u670d\u52a1\u5668\u4e0a\u9762\u91c7\u96c6\u6570\u636e\uff0c\u5e76\u4e14\u8f6c\u6362\u4e3a\u7279\u5b9a\u7684\u5b57\u5178\u683c\u5f0f\uff0c\u8fd9\u79cd\u683c\u5f0f\u662fzabbix\u53ef\u4ee5\u8bc6\u522b\u7684\u4e00\u79cd\u6570\u636e\u5b57\u5178\u683c\u5f0f\uff0c\u4f7f\u7528python\u6765\u7f16\u5199\u76f8\u5bf9shell\u6765\u8bf4\u66f4\u52a0\u4fbf\u6377\u3002<\/p>\n

\u5c06\u811a\u672c\u653e\u5728\u5ba2\u6237\u7aef \/usr\/lib\/zabbix\/alertscripts \u8def\u5f84\u4e0b\u9762<\/p>\n

2.\u4fee\u6539\u88ab\u76d1\u63a7\u7aef\u7684zabbix_agent.conf\u914d\u7f6e\u6587\u4ef6<\/strong><\/span><\/div>\n

UnsafeUserParameters=1<\/p>\n

UserParameter=tcpportlisten,\/usr\/lib\/zabbix\/alertscripts\/check_port.sh<\/p>\n

\u91cd\u542f\u5ba2\u6237\u7aef\u670d\u52a1<\/p>\n

3.\u670d\u52a1\u7aef\u6d4b\u8bd5<\/strong><\/span><\/div>\n

\u6267\u884c\u547d\u4ee4\uff1azabbix_get -s 192.168.92.9 -p 10050 -k tcpportlisten<\/p>\n

\"\"
\n\u51fa\u73b0\u4e0a\u9762\u683c\u5f0f\u7684\u6570\u636e\uff0c\u8bf4\u660e\u811a\u672c\u7f16\u5199\u6210\u529f\uff01\uff01\uff01<\/p>\n

\u7b2c\u4e8c\uff1a\u9875\u9762\u914d\u7f6e<\/strong><\/div>\n
1.\u6dfb\u52a0\u6a21\u677f<\/strong><\/span><\/div>\n

\"\"<\/p>\n

2.\u6dfb\u52a0\u81ea\u52a8\u53d1\u73b0\u89c4\u5219<\/strong><\/span><\/div>\n

\u65b0\u521b\u5efa\u7684\u6a21\u677f\u4e2d\u70b9\u51fb-->\u81ea\u52a8\u53d1\u73b0\u89c4\u5219-->\u7136\u540e\u9009\u62e9\u521b\u5efa\u53d1\u73b0\u89c4\u5219<\/p>\n

\"\"
\n\u8bf4\u660e\uff1a\u4e0a\u9762\u7684key \u4e00\u5b9a\u8981\u548c\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684key \u4fdd\u6301\u4e00\u81f4\u3002\u5c31\u662f\u6211\u4eec\u5728zabbix_agent.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u7684\u4e24\u884c\u4ee3\u7801\u4e2d\u7684\u7b2c\u4e8c\u884c\u4e2d\u6dfb\u52a0\u7684\u53c2\u6570key<\/p>\n

3.\u521b\u5efa\u76d1\u63a7\u9879\u539f\u578b<\/strong><\/span><\/div>\n

\"\"
\n\u4e0a\u9762\u4e2d\u7684\u952e\u503c \u4e2d\u7684 #TCP_PORT} \u548c\u6211\u4eec\u7684\u811a\u672c check_port.sh \u4e2d\u7684\u53c2\u6570\u4e00\u81f4<\/p>\n

4.\u521b\u5efa\u89e6\u53d1\u5668\u7c7b\u578b<\/strong><\/span><\/div>\n

\"\"<\/p>\n

\u7b2c\u4e09\uff1a\u6279\u91cf\u6dfb\u52a0\u6307\u5b9a\u7aef\u53e3<\/strong><\/div>\n

\u6709\u65f6\u5019\u6211\u4eec\u4e0d\u9700\u8981\u76d1\u63a7\u81ea\u52a8\u626b\u63cf\u51fa\u6765\u7684\u6240\u6709\u7684\u7aef\u53e3\uff0c\u8fd9\u4e9b\u7aef\u53e3\u9700\u8981\u6211\u4eec\u6307\u5b9a\uff0c\u8fd9\u4e2a\u9700\u6c42\u4e5f\u662f\u6bd4\u8f83\u5e38\u89c1\u7684\uff0c\u6709\u4e86\u4e0a\u9762\u7684\u57fa\u7840\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u4e1c\u897f\u5176\u5b9e\u662f\u6bd4\u8f83\u7b80\u5355\uff0c\u5176\u5b9e\u4ed4\u7ec6\u770b\u770b\u811a\u672c\u5c31\u80fd\u5b9e\u73b0\u3002<\/p>\n

\u8981\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u6211\u4eec\u53ea\u9700\u8981\uff0c\u5c06\u811a\u672c\u66ff\u6362\u6210\u4e0b\u9762\u5185\u5bb9\u5373\u53ef\uff1a<\/p>\n

\"\"<\/p>\n

\u6211\u4eec\u53ea\u9700\u8981\u5728port_list\u4e2d\u6dfb\u52a0\u60f3\u8981\u76d1\u63a7\u7684\u7aef\u53e3\u53f7\u5373\u53ef\uff01\u6ce8\u610f\u683c\u5f0f\uff0c\u4ee5\u9017\u53f7\u9694\u5f00\uff01<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.cnblogs.com\/JeremyWYL\/p\/8328081.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/zabbix-port.html<\/a>\u7f16\u8f91\uff1a\u59dc\u663e\u8d6b\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u3000\u5728\u76d1\u63a7\u751f\u4ea7\u73af\u5883\u7684\u670d\u52a1\u7684\u65f6\u5019\uff0c\u901a\u5e38\u9700\u8981\u5bf9\u591a\u4e2a\u7aef\u53e3\u8fdb\u884c\u76d1\u63a7\uff0c\u5982\u679c\u6211\u4eec\u624b\u52a8\u4e00\u4e2a\u4e00\u4e2a\u7684\u6dfb\u52a0\uff0c\u8fd9\u5c06\u662f\u4e00\u4ef6\u5f88\u9ebb\u70e6\u7684 […]<\/p>\n","protected":false},"author":370,"featured_media":22549,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-93361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=93361"}],"version-history":[{"count":6,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93361\/revisions"}],"predecessor-version":[{"id":93568,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/93361\/revisions\/93568"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/22549"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=93361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=93361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=93361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}