2022 Zabbix中国峰会
2022 Zabbix中国峰会

17 net.dns.get 返回值

概述

本部分提供 Zabbix agent 2监控项 net.dns.get 返回值的详细信息。

详情

该监控项的输出是一个对象,它包含DNS记录信息,是基于监控项键提供的参数获得的。

例如net.dns.get[,example.com] 监控项可能会返回被拒绝查询的 JSON 如下:

{
           "flags": [
               "RA"
           ],
           "query_time": "0.00",
           "question_section": [
               {
                   "qclass": "IN",
                   "qname": "example.com.",
                   "qtype": "SOA"
               }
           ],
           "response_code": "REFUSED",
           "zbx_error_code": 0
       }

通过提供DNS服务器的IP地址 net.dns.get[192.0.2.0,example.com] 监控项可能会返回以下JSON:

{
           "answer_section": [
               {
                   "class": "IN",
                   "name": "example.com.",
                   "rdata": {
                       "expire": 1209600,
                       "mbox": "noc.dns.example.org.",
                       "minttl": 3600,
                       "ns": "ns.example.org.",
                       "refresh": 7200,
                       "retry": 3600,
                       "serial": 2022091378
                   },
                   "rdlength": 44,
                   "ttl": 1205,
                   "type": "SOA"
               }
           ],
           "flags": [
               "RA"
           ],
           "query_time": "0.02",
           "question_section": [
               {
                   "qclass": "IN",
                   "qname": "example.com.",
                   "qtype": "SOA"
               }
           ],
           "response_code": "NOERROR",
           "zbx_error_code": 0
       }

如果存在连接问题net.dns.get[192.0.2.0,example.com] 监控项可能返回错误:

{
           "zbx_error_code": -1,
           "zbx_error_msg": "Communication error: read udp 192.0.2.0:12345->192.0.2.0:53: i/o timeout"
       }

以下是可能出现的错误码类型:

场景 "zabbix错误码" "zabbix错误信息"
没有错误,并且已收到并解析 DNS 响应. 0
DNS 已关闭. -1 "通信错误"
JSON解析过程中出现错误 -2 "收到非预期的响应"

通过附加的参数net.dns.get[192.0.2.0,example.com,ANY,5,5,tcp,"cdflag,rdflag,dnssec,nsid,edns0,aaflag,adflag"] 监控项可能返回以下JSON:

{
           "additional_section": [
               {
                   "extended_rcode": 32768,
                   "name": ".",
                   "rdata": {
                       "options": [
                       {
                           "code": 0,
                           "nsid": "67 70 64 6e 73 2d 6c 70 70"
                       }
                   ]
               },
                   "rdlength": 13,
                   "type": "OPT",
                   "udp_payload": 512
               }
           ],
           "answer_section": [
               {
                   "class": "IN",
                   "name": "example.com.",
                   "rdata": {
                       "a": "192.0.2.0"
                   },
                   "rdlength": 4,
                   "ttl": 19308,
                   "type": "A"
               },
               {
                   "class": "IN",
                   "name": "example.com.",
                   "rdata": {
                       "algorithm": 13,
                       "expiration": 1704715951,
                       "inception": 1702910624,
                       "key_tag": 21021,
                       "labels": 2,
                       "orig_ttl": 86400,
                       "signature": "HVBOBcJJQy0S08J3f8kviPj8UkEUj7wmyiMyQqPSWgQIY9SCEJ5plq6KuxJmtAek1txZWXDo+6tpIC6DIVBnuw==",
                       "signer_name": "example.com.",
                       "type_covered": "A"
                   },
                   "rdlength": 95,
                   "ttl": 19308,
                   "type": "RRSIG"
               }
           ],
           "flags": [
               "RD",
               "RA",
               "AD",
               "CD"
           ],
           "query_time": "0.05",
           "question_section": [
               {
                   "qclass": "IN",
                   "qname": "example.com.",
                   "qtype": "ANY"
               }
           ],
           "response_code": "NOERROR",
           "zbx_error_code": 0
       }

参见

对于 DNS 记录的更多信息,查阅 :