{"id":18212,"date":"2014-03-04T06:04:25","date_gmt":"2014-03-03T22:04:25","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/03\/04\/%e4%bb%a5-nagios-%e5%81%b5%e6%b8%ac-dns-server\/"},"modified":"2021-03-18T17:23:51","modified_gmt":"2021-03-18T09:23:51","slug":"%e4%bb%a5-nagios-%e5%81%b5%e6%b8%ac-dns-server","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/03\/04\/%e4%bb%a5-nagios-%e5%81%b5%e6%b8%ac-dns-server\/","title":{"rendered":"\u4ee5 Nagios \u5075\u6e2c DNS Server"},"content":{"rendered":"<p>1. \u6aa2\u67e5\u662f\u5426\u6709 check_dns\u00a0\u6aa2\u67e5\u6307\u4ee4<br \/># <span style=\"color: #ff0000\">locate check_dns<\/span><br \/><span style=\"color: #0000ff\">\/usr\/lib64\/nagios\/plugins\/check_dns<\/span><\/p>\n<p>2. \u6aa2\u67e5\u4e00\u4e0b\uff0ccheck_dns\u00a0\u9808\u8981\u52a0\u5165\u7684\u53c3\u6578<br \/># <span style=\"color: #ff0000\">\/usr\/lib64\/nagios\/plugins\/check_dns -h<\/span><br \/><span style=\"color: #0000ff\">Options:<\/span><br \/><span style=\"color: #0000ff\">\u00a0-h, &#8211;help<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Print detailed help screen<\/span><br \/><span style=\"color: #0000ff\">\u00a0-V, &#8211;version<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Print version information<\/span><br \/><span style=\"color: #0000ff\">\u00a0&#8211;extra-opts=[section][@file]<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Read options from an ini file. See http:\/\/nagiosplugins.org\/extra-opts<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 for usage and examples.<\/span><br \/><span style=\"color: #ff0000\">\u00a0-H, &#8211;hostname=HOST<\/span><br \/><span style=\"color: #ff0000\">\u00a0\u00a0\u00a0 The name or address you want to query<\/span><br \/><span style=\"color: #ff0000\">\u00a0-s, &#8211;server=HOST<\/span><br \/><span style=\"color: #ff0000\">\u00a0\u00a0\u00a0 Optional DNS server you want to use for the lookup<\/span><br \/><span style=\"color: #0000ff\">\u00a0-a, &#8211;expected-address=IP-ADDRESS|HOST<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Optional IP-ADDRESS you expect the DNS server to return. HOST must end with<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 a dot (.). This option can be repeated multiple times (Returns OK if any<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 value match). If multiple addresses are returned at once, you have to match<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 the whole string of addresses separated with commas (sorted alphabetically).<\/span><br \/><span style=\"color: #0000ff\">\u00a0-A, &#8211;expect-authority<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Optionally expect the DNS server to be authoritative for the lookup<\/span><br \/><span style=\"color: #0000ff\">\u00a0-w, &#8211;warning=seconds<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Return warning if elapsed time exceeds value. Default off<\/span><br \/><span style=\"color: #0000ff\">\u00a0-c, &#8211;critical=seconds<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Return critical if elapsed time exceeds value. Default off<\/span><br \/><span style=\"color: #0000ff\">\u00a0-t, &#8211;timeout=INTEGER<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Seconds before connection times out (default: 10)<\/span>[@more@]3.\u00a0\u6e2c\u8a66\u4e00\u4e0b<br \/># <span style=\"color: #ff0000\">\/usr\/lib64\/nagios\/plugins\/check_dns -H www.ilc.edu.tw -s DNS&#8217;IP<\/span><br \/><span style=\"color: #0000ff\">DNS OK: 0.012 seconds response time. www.ilc.edu.tw returns 140.111.66.96|time=0.012217s;;;0.000000<\/span><\/p>\n<p>4. \u5728 \/etc\/nagios\/objects\/commands.cfg\u00a0\u6a94\u6848\u52a0\u5165<\/p>\n<p><span style=\"color: #0000ff\"># &#8216;check_dns&#8217; command definition<\/span><br \/><span style=\"color: #0000ff\">define command{<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 command_name\u00a0\u00a0\u00a0 check_dns<\/span><br \/><span style=\"color: #0000ff\">\u00a0 \u00a0 \u00a0\u00a0\u00a0 command_line\u00a0\u00a0\u00a0 $USER1$\/check_dns -H $ARG1$ -s $HOSTADDRESS$<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span><\/p>\n<p>5.\u00a0\u5728\u8981\u5075\u6e2c\u7684 DNS \u4e3b\u6a5f\u52a0\u5165 dns.test.ilc.edu.tw \u5c31\u662f\u8981\u5075\u6e2c\u7684 DNS \u4e3b\u6a5f<br \/># <span style=\"color: #ff0000\">vim \/etc\/nagios\/servers\/dns.cfg<\/span><br \/><span style=\"color: #0000ff\">define service{<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 generic-service\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ; Name of service template to use<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 host_name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dns.test.ilc.edu.tw<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 service_description\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DNS<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 check_command\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 check_dns!www.ilc.edu.tw<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 notifications_enabled\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span><\/p>\n<p>\u91cd\u65b0\u555f\u52d5 Nagios <br \/># <span style=\"color: #ff0000\">service nagios restart<\/span><br \/><span style=\"color: #0000ff\">Running configuration check&#8230;done.<\/span><br \/><span style=\"color: #0000ff\">Stopping nagios: .done.<\/span><br \/><span style=\"color: #0000ff\">Starting nagios: done.<\/span><\/p>\n<p>\u5982\u679c\u6c92\u6709\u51fa\u73fe\u932f\u8aa4\u8a0a\u606f\uff0c\u4ee3\u8868\u8a2d\u5b9a\u6210\u529f<\/p>\n<p>\u9019\u6642\u5019\u61c9\u8a72\u53ef\u4ee5\u770b\u5230\u4e0b\u9762\u7684\u5716<br \/><a id=\"res_2367471\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-2367471.png\"><img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-2367471.png\" border=\"0\" alt=\"\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u6aa2\u67e5\u662f\u5426\u6709 check_dns\u00a0\u6aa2\u67e5\u6307\u4ee4# locate check_dns\/usr\/lib64\/nag &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/03\/04\/%e4%bb%a5-nagios-%e5%81%b5%e6%b8%ac-dns-server\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u4ee5 Nagios \u5075\u6e2c DNS Server\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[131],"tags":[],"class_list":["post-18212","post","type-post","status-publish","format-standard","hentry","category-c-78476"],"meta_key":{"_encloseme":["1"],"lt_post_id":["471747"],"_pingme":["1"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18212"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=18212"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18212\/revisions"}],"predecessor-version":[{"id":19869,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18212\/revisions\/19869"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=18212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=18212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=18212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}