本部分提供 Zabbix agent 2监控项 net.dns.get
返回值的详细信息。
此监控项的输出是一个对象,其中包含基于监控项键中提供的参数的DNS记录信息。
例如,net.dns.get[,example.com]
监控项可能返回以下JSON,表示被拒绝的查询:
{
"flags": [
"RA"
],
"query_time": "0.019030",
"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.029556",
"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" | "zbx_error_msg" |
---|---|---|
无错误,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.058221",
"question_section": [
{
"qclass": "IN",
"qname": "example.com.",
"qtype": "ANY"
}
],
"response_code": "NOERROR",
"zbx_error_code": 0
}
对于 DNS 记录的更多信息,查阅 :