{"id":85875,"date":"2023-12-28T22:00:13","date_gmt":"2023-12-28T14:00:13","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=85875"},"modified":"2023-12-28T22:00:13","modified_gmt":"2023-12-28T14:00:13","slug":"zabbix-fping","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zabbix-fping.html","title":{"rendered":"Zabbix\u81ea\u52a8\u53d1\u73b0\u4e4bfping"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nZabbix\u81ea\u52a8\u53d1\u73b0\u529f\u80fd\u4ece\u914d\u7f6e\u6d41\u7a0b\u4e0a\u6bd4\u8f83\u7b80\u5355\uff1aDiscovery\u4e0eAction\u3002\u5728\u505aZabbix\u7684\u81ea\u52a8\u53d1\u73b0\u9a8c\u8bc1\u65f6\uff0c\u4f7f\u7528\"ICMP ping\"\u7684check\u65b9\u5f0f\u65f6\uff0c\u81ea\u52a8\u53d1\u73b0\u529f\u80fd\u5e76\u4e0d\u751f\u6548\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\uff0e\u73af\u5883 <\/strong><\/div>\n
1. zabbix\u73af\u5883<\/strong><\/span><\/div>\n
    Zabbix\uff1azabbix-3.0.1server\/agent<\/ol>\n
    2. \u914d\u7f6e\u73af\u5883<\/strong><\/span><\/div>\n

    \u53d1\u73b0\u672c\u5730\u7f51\u7edc172.19.200.1-254\uff0cCheck\uff1aICMP ping\uff0c\u5982\u4e0b\uff1a
    \n\"\"<\/p>\n

    ICMP ping\u65b9\u5f0f\u4e0b\uff0cUP\u72b6\u6001\u7684\u4e3b\u673a\u6dfb\u52a0\u5230\"Discovery hosts\"\u7ec4\uff0c\u5982\u4e0b\uff1a
    \n\"\"<\/p>\n

    \u4e8c\uff0e\u81ea\u52a8\u53d1\u73b0\u5931\u6548<\/strong><\/div>\n
    1. \u73b0\u8c61<\/strong><\/span><\/div>\n

    \u5728\u81ea\u52a8\u53d1\u73b0\u7684discovery\u4e0eaction\u6d41\u7a0b\u914d\u7f6e\u6b63\u786e\u7684\u524d\u63d0\u4e0b\uff0c\u7b49\u5f8510\u5206\u949f\u89c2\u5bdf\uff0c\u81ea\u52a8\u53d1\u73b0\u529f\u80fd\u5e76\u4e0d\u751f\u6548\u3002<\/p>\n

    2. \u5b9a\u4f4d\u6545\u969c<\/strong><\/span><\/div>\n

    #\u53d1\u73b0\u6709\"\u627e\u4e0d\u5230\/usr\/sbin\/fping<\/span>\u6587\u4ef6\"\u7684\u4fe1\u606f\u8bb0\u5f55\u3002
    \n[root@localhost ~]# vim \/tmp\/zabbix_server.log<\/code><\/p>\n

    1412:20160621:110040.593 \/usr\/sbin\/fping: [2] No such file or directory<\/p>\n

    3. \u6545\u969c\u5206\u6790<\/strong><\/span><\/div>\n

    \"ICMP ping\"<\/span>\u7684check\u65b9\u5f0f\uff0c\u4f7f\u7528\/usr\/sbin\/fping<\/span>\u547d\u4ee4\u68c0\u6d4b\u72b6\u6001\uff0c\u5982\u679c\u7cfb\u7edf\u6ca1\u6709\u5b89\u88c5\u6216fping\u547d\u4ee4\u6267\u884c\u8def\u5f84\u6709\u8bef\uff0c\u5219check\u65b9\u5f0f\u4e0d\u80fd\u53d1\u73b0\u8bbe\u5907\uff0c\u81ea\u52a8\u53d1\u73b0\u529f\u80fd\u5931\u6548\u3002<\/p>\n

    \u4e09\uff0e\u5b89\u88c5\u914d\u7f6efping<\/strong><\/div>\n
    1. \u5b89\u88c5fping<\/strong><\/span><\/div>\n

    #fping\u76f8\u5bf9ping\uff0c\u53ef\u4ee5\u540c\u65f6ping\u591a\u4e2a\u76ee\u6807\u5e76\u4e14\u6709\u591a\u79cd\u7edf\u8ba1\u8f93\u51fa\u683c\u5f0f\uff0c#fping\u76ee\u524d\u53ea\u80fd\u901a\u8fc7\u7f16\u8bd1\u7684\u65b9\u5f0f\u5b89\u88c5\u3002
    \n[root@localhost ~]# cd \/usr\/local\/src
    \n[root@localhost src]# wget http:\/\/www.fping.org\/dist\/fping-3.13.tar.gz
    \n[root@localhost src]# tar -zxvf fping-3.13.tar.gz
    \n[root@localhost src]# cd fping-3.13
    \n[root@localhost fping-3.13]# .\/configure
    \n[root@localhost fping-3.13]# make && make install<\/code><\/p>\n

    2. \u914d\u7f6efping\u6267\u884c\u8def\u5f84<\/strong><\/span><\/div>\n

    #zabbix_server\u914d\u7f6e\u6587\u4ef6\u4e2d\u9ed8\u8ba4fping\u7684\u6267\u884c\u8def\u5f84\u88ab\u6ce8\u91ca\u6389\u4e86\uff0c\u6b64\u65f6\u9ed8\u8ba4\u8def\u5f84\u5c31\u4e3a\uff1a\/usr\/sbin\/fping<\/span><\/p>\n

    #\u53ef\u4ee5\u914d\u7f6efping\u7684\u6267\u884c\u8def\u5f84\uff0c\u5982\u4e0b\uff1a
    \n[root@localhost ~]# sed -i 's|# FpingLocation=\/usr\/sbin\/fping|FpingLocation=\/usr\/local\/sbin\/fping|g' \/usr\/local\/zabbix\/etc\/zabbix_server.conf<\/code><\/p>\n

    #\u6216\u8005\u4e0d\u4fee\u6539 zabbix_server.conf<\/span>\u6587\u4ef6\uff0c\u4f7f\u7528\u8f6f\u8fde\u63a5ln -s \/usr\/local\/sbin\/fping \/usr\/sbin\/fping<\/span><\/p>\n

    3. \u914d\u7f6efping\u6743\u9650<\/strong><\/span><\/div>\n

    #fping\u5fc5\u987b\u7531root\u7528\u6237\u6267\u884c\uff0c\u5982\u679c\u975eroot\u8d26\u53f7\u6267\u884cfping\uff0c\u67e5\u770bzabbix_server\u65e5\u5fd7\u4f1a\u6709\u5982\u4e0b\u62a5\u8b66\u4fe1\u606f\uff1a
    \n#21822:20160621:151232.024 fping failed: (null): can't create socket (must run as root?) : Permission denied<\/code><\/p>\n

    #\u5982\u679c\u662froot\u8d26\u53f7\u5b89\u88c5\u7684fping\uff0c\u53ef\u4ee5\u4e0d\u7528\u4fee\u6539owner<\/p>\n

    #\u4f46zabbix_server\u662f\u4f7f\u7528zabbix\u8d26\u53f7\u8c03\u7528\u547d\u4ee4\u7684\uff0c\u53ef\u4ee5\u4e3afping\u8bbe\u7f6eSUID\u6743\u9650\uff0c\u5982\u4e0b\uff1a
    \n[root@localhost ~]# chown root:root \/usr\/local\/sbin\/fping
    \n[root@localhost ~]# chmod u+s \/usr\/local\/sbin\/fping <\/code><\/p>\n

    \u56db\uff0e\u9a8c\u8bc1<\/strong><\/div>\n
    1. \u9a8c\u8bc1Discovery<\/strong><\/span><\/div>\n

    Monitoring--> Discovery--> Discovery rule\uff0c\u9009\u62e9\"Local network\"(\u521b\u5efadiscovery\u65f6\u7684name)\uff0c\u5982\u4e0b\uff1a
    \n\"\"<\/p>\n

    2. \u9a8c\u8bc1Action<\/strong><\/span><\/div>\n

    Configuration--> Hosts--> Group\uff0c\u9009\u62e9\"Discovery hosts\"\u7ec4\uff0c\u5982\u4e0b\uff1a
    \n\"\"<\/p>\n

    \n

    \u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.linuxidc.com\/Linux\/2017-10\/147563.htm<\/a><\/p>\n

    \u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/zabbix-fping.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

    \u5bfc\u8bfb Zabbix\u81ea\u52a8\u53d1\u73b0\u529f\u80fd\u4ece\u914d\u7f6e\u6d41\u7a0b\u4e0a\u6bd4\u8f83\u7b80\u5355\uff1aDiscovery\u4e0eAction\u3002\u5728\u505aZabbix\u7684\u81ea\u52a8\u53d1 […]<\/p>\n","protected":false},"author":63,"featured_media":85885,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-85875","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\/85875","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=85875"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/85875\/revisions"}],"predecessor-version":[{"id":85922,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/85875\/revisions\/85922"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/85885"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=85875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=85875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=85875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}