[comment]: # ({d112b113-c53dbd53})
# 17 Atgrieztās vērtības priekš net.dns.get

[comment]: # ({/d112b113-c53dbd53})

[comment]: # ({1e586c8a-20702625})
#### Pārskats

Šajā sadaļā ir sniegta informācija par [`net.dns.get`](/manual/config/items/itemtypes/zabbix_agent/zabbix_agent2#net.dns.get) Zabbix aģents 2 vienuma atgrieztajām vērtībām.

[comment]: # ({/1e586c8a-20702625})

[comment]: # ({3e4ea29a-c86961d7})
#### Detaļas

Šī vienuma izvade ir objekts, kas satur DNS ieraksta informāciju, pamatojoties uz vienuma atslēgā norādītajiem parametriem.

Piemēram, vienums `net.dns.get[,example.com]` var atgriezt šādu atteiktas vaicājuma JSON:

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

Norādot DNS servera IP adresi, vienums `net.dns.get[192.0.2.1,example.com]` var atgriezt šādu JSON:

```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
}
```

Ja rodas savienojuma problēma, vienums `net.dns.get[192.0.2.1,example.com]` var atgriezt kļūdu:

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

Iespējami šādi kļūdu kodu veidi:

|Scenārijs|"zbx_error_code"|"zbx_error_msg"|
|----|--|----|
|Nav kļūdu, un DNS atbilde tika saņemta un parsēta.|0| |
|DNS nedarbojas.|-1|"Communication error"|
|Kļūda rodas JSON parsēšanas laikā|-2|"Received unexpected response"|

Ar papildu parametriem vienums `net.dns.get[192.0.2.1,example.com,ANY,5,5,tcp,"cdflag,rdflag,dnssec,nsid,edns0,aaflag,adflag"]` var atgriezt šādu JSON:

```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.1"
            },
            "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
}
```

[comment]: # ({/3e4ea29a-c86961d7})

[comment]: # ({a2fa5372-89da787d})
#### Skatiet arī

Lai iegūtu vairāk informācijas par DNS ierakstiem, skatiet:

-   [Domēna vārdi — ieviešana un specifikācija](https://datatracker.ietf.org/doc/html/rfc1035)
-   [Domēna vārdu sistēmas (DNS) parametri](https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml)

[comment]: # ({/a2fa5372-89da787d})
