Skip to content

DNS check fails for CNAME records #10558

@danvaida

Description

@danvaida

Output of the info page (if this is a bug)
Log entry:

2021-11-03 15:33:39 CET | CORE | ERROR | (pkg/collector/python/datadog_agent.go:116 in LogMessage) | dns_check:xyz-dns-check:95e92da93d0a5f5b | (dns_check.py:108) | DNS resolution of xyz.domain.com has failed.
Traceback (most recent call last):
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/dns_check/dns_check.py", line 97, in check
    self._check_answer(answer, resolves_as)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/datadog_checks/dns_check/dns_check.py", line 121, in _check_answer
    ips = [x.strip().lower() for x in resolves_as.split(',')]
AttributeError: 'list' object has no attribute 'split'
$ sudo datadog-agent status
Getting the status from the agent.

===============
Agent (v6.19.2)
===============

  Status date: 2021-11-03 15:39:01.306857 CET
  Agent start: 2021-11-03 13:40:46.309635 CET
  Pid: 28111
  Go Version: go1.13.8
  Python Version: 2.7.17
  Build arch: amd64
  Check Runners: 4
  Log Level: info
[...]
  Host Info
  =========
    bootTime: 2021-11-02 17:10:20.000000 CET
    kernelVersion: 3.10.0-957.5.1.el7.x86_64
    os: linux
    platform: centos
    platformFamily: rhel
    platformVersion: 7.6.1810
    procs: 196
    uptime: 20h30m27s
[...]
dns_check (1.5.2)
    -----------------
      Instance ID: dns_check:xyz-dns-check:95e92da93d0a5f5b [OK]
      Configuration Source: file:/etc/datadog-agent/conf.d/dns_check.d/conf.yaml
      Total Runs: 473
      Metric Samples: Last Run: 0, Total: 0
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 473
      Average Execution Time : 2ms
      Last Execution Date : 2021-11-03 15:38:54.000000 CET
      Last Successful Execution Date : 2021-11-03 15:38:54.000000 CET

Describe what happened:
Check is unable to resolve the record.

Describe what you expected:
Check is able to resolve the record.

Steps to reproduce the issue:
Try to resolve a CNAME record.

$ cat /etc/datadog-agent/conf.d/dns_check.d/conf.yaml
init_config: {}
instances:
  - hostname: xyz.domain.com
    name: xyz-dns-check
    resolves_as: "1.1.1.1"
    tags: 
      - "team:erp"

Additional environment details (Operating System, Cloud provider, etc):

Haven't had the chance yet to try and reproduce this on the latest version.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions