{"id":1193,"date":"2019-04-08T10:51:37","date_gmt":"2019-04-08T02:51:37","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=1193"},"modified":"2019-04-08T10:51:37","modified_gmt":"2019-04-08T02:51:37","slug":"zabbix_server%e7%9a%84%e8%87%aa%e5%8a%a8%e5%8f%91%e7%8e%b0%ef%bc%8c%e5%ae%9e%e7%8e%b0%e6%89%b9%e9%87%8f%e6%b7%bb%e5%8a%a0%e4%b8%bb%e6%9c%ba%ef%bc%8c%e5%b9%b6%e9%93%be%e6%8e%a5%e5%88%b0%e6%a8%a1","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=1193","title":{"rendered":"zabbix_server\u7684\u81ea\u52a8\u53d1\u73b0\uff0c\u5b9e\u73b0\u6279\u91cf\u6dfb\u52a0\u4e3b\u673a\uff0c\u5e76\u94fe\u63a5\u5230\u6a21\u677f"},"content":{"rendered":"<p>\u4e00\u3001\u9700\u6c42<\/p>\n<p>zabbix \u670d\u52a1\u5668\u53ef\u4ee5\u624b\u52a8\u52a0\u5165zabbix-agent\u5ba2\u6237\u7aef\uff0c\u5bf9\u4e8e\u5c11\u91cf\u7684\u673a\u5668\uff0c\u8fd9\u6ca1\u6709\u4ec0\u4e48\u3002\u4f46\u5230\u4e86\u7ebf\u4e0a\uff0c\u6211\u4eec\u6709\u5927\u91cf\u7684\u670d\u52a1\u5668\u9700\u8981\u76d1\u63a7\u65f6\uff0c\u5982\u679c\u518d\u4e00\u4e2a\u4e2a\u7684\u624b\u52a8\u52a0\u7684\u8bdd\uff0c\u5de5\u4f5c\u91cf\u52bf\u5fc5\u4f1a\u589e\u52a0\u5f88\u591a\u3002\u8fd9\u65f6\uff0czabbix-server \u7684Discovery \u81ea\u52a8\u53d1\u73b0 \u529f\u80fd\u4fbf\u6d3e\u4e0a\u4e86\u7528\u573a\u3002<\/p>\n<p>\u4e8c\u3001\u6761\u4ef6<\/p>\n<p>1.zabbix server \u5df2\u7ecf\u90e8\u7f72\u597d\uff0c\u6240\u9700\u8981\u52a0\u5165\u7684\u670d\u52a1\u5668zabbix-agent\u5df2\u7ecf\u5b89\u88c5\u3002<\/p>\n<p>2.\u9632\u706b\u5899\u90fd\u5f00\u653e\u7aef\u53e3\uff0c\u4e3b\u8981\u662f10050\u300110051\u7aef\u53e3\uff0c\u6216\u8005\u5173\u95ed\u6574\u4e2aiptables<\/p>\n<p>\u4e09\u3001zabbix-agent\u5ba2\u6237\u7aef\u7684\u8bbe\u7f6e<\/p>\n<p>1.\u6253\u5f00zabbix-agent.conf\u914d\u7f6e\u6587\u4ef6\uff0c\u53ea\u9700\u8981\u4fee\u65392\u5904\u914d\u7f6e.\u5927\u6279\u91cf\u7684\u4fee\u6539\uff0c\u53ef\u4ee5\u5229\u7528\u81ea\u52a8\u5316\u90e8\u7f72\u5de5\u5177\u3001\u5982saltstack\u3001ansible\u7b49\u3002\u6211\u7528\u7684\u662fsaltstack\u63a8\u9001\u6587\u4ef6\u7684\u65b9\u5f0f\u8fdb\u884c\u4fee\u6539\uff0c\u5728\u672c\u5b9e\u9a8c\u73af\u5883\u4e2d\uff0c\u6211\u7528\u7684\u662f\u56fd\u4ea7\u7684\u4e00\u4e2a\u6279\u91cf\u5de5\u5177CheungSSH\u3002<\/p>\n<p>2.\u6279\u91cf\u6267\u884c\u7684\u547d\u4ee4<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>sed -i 's\/Server=127.0.0.1\/Server=10.8.0.22\/g' \/etc\/zabbix\/zabbix_agentd.conf\nsed -i 's\/ServerActive=127.0.0.1\/ServerActive=10.8.0.22\/g' \/etc\/zabbix\/zabbix_agentd.conf\n\ngrep \"Server\" \/etc\/zabbix\/zabbix_agentd.conf | grep -v '^#'\n\nservice zabbix-agent restart<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"https:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>\u4e0a\u8ff0\u547d\u4ee4\u5b8c\u6210\u540e\uff0c\u8981\u5728zabbix-server\u4e0a\u521b\u5efadiscover\u89c4\u5219<\/p>\n<p>\u56db\u3001zabbix-server \u767b\u9646web\u754c\u9762\u8fdb\u884c\u8bbe\u7f6e,\u521b\u5efa\u89c4\u5219\uff0c\u5e76\u81ea\u52a8\u52a0\u5165\uff0c\u81ea\u52a8\u94fe\u63a5\u6a21\u677f<\/p>\n<p>1.Configuration&#8211;&gt;Discovery&#8211;&gt;Create discovery rule<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407153320968-1997423388.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407153331390-1147280793.jpg\" alt=\"\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407153338625-515490397.jpg\" alt=\"\" \/><br \/>\n\u4e0b\u9762\u662f\u521b\u5efa\u89c4\u5219\u65f6\u7684\u5177\u4f53\u53c2\u6570\uff0c\u6765\u81ea\u5b98\u7f51\uff1a<\/p>\n<p>&nbsp;<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<thead>\n<tr>\n<td valign=\"top\">\n<p align=\"left\"><strong>Parameter<\/strong><\/p>\n<\/td>\n<td valign=\"top\"><strong>Description<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td valign=\"top\"><em>Name<\/em><\/td>\n<td valign=\"top\">Unique name of the rule. For example, \u201cLocal network\u201d.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>Discovery by proxy<\/em><\/td>\n<td valign=\"top\">What performs discovery:<br \/>\n<strong>no proxy<\/strong>\u00a0&#8211; Zabbix server is doing discovery<br \/>\n<strong>&lt;proxy name&gt;<\/strong>\u00a0&#8211; this proxy performs discovery<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>IP range<\/em><\/td>\n<td valign=\"top\">The range of IP addresses for discovery. It may have the following formats:<br \/>\nSingle IP: 192.168.1.33<br \/>\nRange of IP addresses: 192.168.1-10.1-255. The range is limited by the total number of covered addresses (less than 64K).<br \/>\nIP mask: 192.168.4.0\/24<br \/>\nsupported IP masks:<br \/>\n\/16 &#8211; \/30 for IPv4 addresses<br \/>\n\/112 &#8211; \/128 for IPv6 addresses<br \/>\nList: 192.168.1.1-255, 192.168.2.1-100, 192.168.2.200, 192.168.4.0\/24<br \/>\nSince Zabbix 3.0.0 this field supports spaces, tabulation and multiple lines.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>Delay (in sec)<\/em><\/td>\n<td valign=\"top\">This parameter defines how often Zabbix will execute the rule.<br \/>\nDelay is measured after the execution of previous discovery instance ends so there is no overlap.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>Checks<\/em><\/td>\n<td valign=\"top\">Zabbix will use this list of checks for discovery.<br \/>\nSupported checks: SSH, LDAP, SMTP,\u00a0FTP, HTTP, HTTPS, POP, NNTP, IMAP, TCP, Telnet, Zabbix agent, SNMPv1 agent, SNMPv2 agent, SNMPv3 agent, ICMP ping.<br \/>\nA protocol-based discovery uses the\u00a0<strong>net.tcp.service[]<\/strong>\u00a0functionality to test each host, except for SNMP which queries an SNMP OID. Zabbix agent is tested by querying an item. Please see\u00a0<a title=\"manual:config:items:itemtypes:zabbix_agent\" href=\"https:\/\/www.zabbix.com\/documentation\/3.0\/manual\/config\/items\/itemtypes\/zabbix_agent\">agent items<\/a>\u00a0for more details.<br \/>\nThe &#8216;Ports&#8217; parameter may be one of following:<br \/>\nSingle port: 22<br \/>\nRange of ports: 22-45<br \/>\nList: 22-45,55,60-70<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>Device uniqueness criteria<\/em><\/td>\n<td valign=\"top\">Uniqueness criteria may be:<br \/>\n<strong>IP address<\/strong>\u00a0&#8211; no processing of multiple single-IP devices. If a device with the same IP already exists it will be considered already discovered and a new host will not be added.<br \/>\n<strong>Type of discovery check<\/strong>\u00a0&#8211; either SNMP or Zabbix agent check.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><em>Enabled<\/em><\/td>\n<td valign=\"top\">With the check-box marked the rule is active and will be executed by Zabbix server.<br \/>\nIf unmarked, the rule is not active. It won&#8217;t be executed.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u6dfb\u52a0\u52a8\u4f5c\u3002\u81ea\u52a8\u6dfb\u52a0\u4e3b\u673a\u5230linux server \u7ec4\uff0c\u5e76\u94fe\u63a5\u6a21\u677fLinux Os \u3002<br \/>\n\u9009\u62e9\u3010Configuration\u3011-&gt;\u3010Actions\u3011\uff0c\u5728\u53f3\u8fb9\u201cEvent source\u201d\u9009\u62e9\u201cDiscovery\u201d\uff0c\u7136\u540e\u521b\u5efaAction\u89c4\u5219\u5982\u4e0b\u56fe\u6240\u793a\uff1a<br \/>\n<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407154313406-1151777328.jpg\" alt=\"\" \/><br \/>\n\u8bbe\u7f6e\u52a8\u4f5c\u7684 name:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407154452547-1571480649.jpg\" alt=\"\" \/><\/p>\n<p>\u6dfb\u52a0\u89e6\u53d1\u7684Action\u7684\u6761\u4ef6<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407154527297-2061281174.jpg\" alt=\"\" \/><\/p>\n<p>A: ip \u8303\u56f4\uff0c\u6216\u8005\u67d0\u4e2aip\uff0c\u53ef\u4ee5\u6dfb\u52a0\u591a\u4e2a\u7f51\u6bb5<\/p>\n<p>D:agent\u7684\u72b6\u6001\u662fup<\/p>\n<p>C:\u670d\u52a1\u7c7b\u578b\u662f zabbix-agent<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u9762\u5c31\u662f\u914d\u7f6e\u64cd\u4f5c\uff08Operations\uff09\u3002\u5373\u7b26\u5408\u6761\u4ef6\u540e\uff0c\u8fdb\u884c\u7684\u64cd\u4f5c\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407154904234-2115827446.jpg\" alt=\"\" \/><\/p>\n<p>\u64cd\u4f5c\u4e3b\u8981\u6709\u4e09\u4e2a\uff0c\u6dfb\u52a0\u4e3b\u673a\u3001\u6dfb\u52a0\u5230server\u7ec4\u3001\u94fe\u63a5OS Liunx \u6a21\u677f\uff0c\u70b9\u51fbAdd\u3002\u540e\u7eed\u7684\u8fd8\u53ef\u4ee5\u6dfb\u52a0sendmessage \u7b49\u3002<\/p>\n<p>3.\u89c2\u5bdfMonitoring\u00e0Discovery\u4e2d\uff0c\u6709\u6ca1\u6709\u673a\u5668\u52a0\u5165\u8fdb\u6765\u3002\u4e3a\u4e86\u4fbf\u4e8e\u89c2\u5bdf\uff0c\u6211\u4eec\u4e4b\u524d\u8bbe\u7f6e\u7684\u53d1\u73b0\u8f6e\u8be2\u7684\u65f6\u95f4\u662f60\u79d2\u3002\u5982\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407155714406-1319615575.jpg\" alt=\"\" \/><\/p>\n<p>\u4e0a\u9762\u662f\u626b\u63cf\u53d1\u73b0\u7684\u4e3b\u673a\u30026\u53f0\u5ba2\u6237\u7aef\u90fd\u5df2\u53d1\u73b0\uff0c\u4e0b\u9762\u7684\u662f\u81ea\u52a8\u94fe\u63a5\u5230\u7ec4\u548c\u6a21\u677f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/790056\/201604\/790056-20160407155727422-684120518.jpg\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8f6c\u81ea\uff1ahttp:\/\/www.cnblogs.com\/hanyifeng\/p\/5363864.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u9700\u6c42 zabbix \u670d\u52a1\u5668\u53ef\u4ee5\u624b\u52a8\u52a0\u5165zabbix-agent\u5ba2\u6237\u7aef\uff0c\u5bf9\u4e8e\u5c11\u91cf\u7684\u673a\u5668\uff0c\u8fd9\u6ca1\u6709\u4ec0\u4e48\u3002\u4f46\u5230\u4e86\u7ebf\u4e0a\uff0c\u6211\u4eec\u6709\u5927\u91cf\u7684\u670d\u52a1\u5668\u9700\u8981\u76d1\u63a7\u65f6\uff0c\u5982\u679c\u518d\u4e00\u4e2a\u4e2a\u7684\u624b\u52a8\u52a0\u7684\u8bdd\uff0c\u5de5\u4f5c\u91cf\u52bf\u5fc5\u4f1a\u589e\u52a0\u5f88\u591a\u3002\u8fd9\u65f6\uff0czabbix-server \u7684Discovery \u81ea\u52a8\u53d1\u73b0 \u529f\u80fd\u4fbf\u6d3e\u4e0a\u4e86\u7528\u573a\u3002 \u4e8c\u3001\u6761\u4ef6 1.zabbix server \u5df2\u7ecf\u90e8\u7f72\u597d\uff0c\u6240\u9700\u8981\u52a0\u5165\u7684\u670d\u52a1\u5668zabbix-agent\u5df2\u7ecf\u5b89\u88c5\u3002 2.\u9632\u706b\u5899\u90fd\u5f00\u653e\u7aef\u53e3\uff0c\u4e3b\u8981\u662f10050\u300110051\u7aef\u53e3\uff0c\u6216\u8005\u5173\u95ed\u6574\u4e2aiptables \u4e09\u3001zabbix-agent\u5ba2\u6237\u7aef\u7684\u8bbe\u7f6e 1.\u6253\u5f00zabbix-agent.conf\u914d\u7f6e\u6587\u4ef6\uff0c\u53ea\u9700\u8981\u4fee\u65392\u5904\u914d\u7f6e.\u5927\u6279\u91cf\u7684\u4fee\u6539\uff0c\u53ef\u4ee5\u5229\u7528\u81ea\u52a8\u5316\u90e8\u7f72\u5de5\u5177\u3001\u5982saltstack\u3001ansible\u7b49\u3002\u6211\u7528\u7684\u662fsaltstack\u63a8\u9001\u6587\u4ef6\u7684\u65b9\u5f0f\u8fdb\u884c\u4fee\u6539\uff0c\u5728\u672c\u5b9e\u9a8c\u73af\u5883\u4e2d\uff0c\u6211\u7528\u7684\u662f\u56fd\u4ea7\u7684\u4e00\u4e2a\u6279\u91cf\u5de5\u5177CheungSSH\u3002 2.\u6279\u91cf\u6267\u884c\u7684\u547d\u4ee4 sed -i &#8216;s\/Server=127.0.0.1\/Server=10.8.0.22\/g&#8217; \/etc\/zabbix\/zabbix_agentd.conf sed -i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1193","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1193"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1193\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}