Supported OS Linux

インテグレーションバージョン3.2.1

概要

CoreDNS からリアルタイムにメトリクスを取得して、DNS エラーとキャッシュのヒットまたはミスを視覚化および監視します。

計画と使用

バージョン 1.11.0 から、この OpenMetrics ベースのインテグレーションには、最新モード (ターゲットエンドポイントを指すように openmetrics_endpoint を設定することで有効) とレガシーモード (代わりに prometheus_url を設定することで有効) があります。すべての最新機能を利用するために、Datadog は最新モードを有効にすることを推奨します。詳細は OpenMetrics ベースのインテグレーションにおける最新バージョンとレガシーバージョンを参照してください。

CoreDNS チェックの最新モードは Python 3 を必要とし、.bucket メトリクスを送信し、.sum.count ヒストグラムサンプルを単調カウント型として送信します。これらのメトリクスはレガシーモードでは gauge 型で送信されていました。各モードで利用できるメトリクスの一覧は metadata.csv ファイルを参照してください。

Python 3 を使用できないホスト、または以前にこのインテグレーションモードを実装した場合は、legacy モードの構成例を参照してください。coredns.d/auto_conf.yaml ファイルに依存しているオートディスカバリーのユーザーのために、このファイルはデフォルトで legacy モードのチェックのために prometheus_url オプションを有効にします。デフォルトの構成オプションについては coredns.d/auto_conf.yaml のサンプルを、利用可能なすべての構成オプションについては coredns.d/conf.yaml.example のサンプルを参照してください。

インフラストラクチャーリスト

CoreDNS チェックは Datadog Agent パッケージに含まれています。サーバーに追加でインストールする必要はありません。

ブラウザトラブルシューティング

Docker

コンテナで実行中の Agent に対してこのチェックを構成するには:

メトリクスの収集

アプリケーションのコンテナで、オートディスカバリーのインテグレーションテンプレートを Docker ラベルとして設定します。

LABEL "com.datadoghq.ad.check_names"='["coredns"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"openmetrics_endpoint":"http://%%host%%:9153/metrics", "tags":["dns-pod:%%host%%"]}]'

この OpenMetrics ベースのチェックのレガシーモードを有効にするには、openmetrics_endpointprometheus_url に置き換えます。

LABEL "com.datadoghq.ad.instances"='[{"prometheus_url":"http://%%host%%:9153/metrics", "tags":["dns-pod:%%host%%"]}]' 

:

  • 出荷時の coredns.d/auto_conf.yaml ファイルは、レガシーモードのデフォルトで prometheus_url オプションを有効にします。
  • dns-pod タグは、対象の DNS ポッド IP を追跡します。他のタグは、サービスディスカバリーを使用して情報をポーリングする Datadog Agent に関連します。
  • ポッドでサービスディスカバリーアノテーションを実行する必要があります。デプロイの場合は、テンプレートの仕様のメタデータにアノテーションを追加します。外側のレベルの仕様には追加しないでください。

収集データ

Datadog Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、Docker ログ収集を参照してください。

次に、ログインテグレーションを Docker ラベルとして設定します。

LABEL "com.datadoghq.ad.logs"='[{"source":"coredns","service":"<SERVICE_NAME>"}]'

ガイド

このチェックを、Kubernetes で実行している Agent に構成します。

メトリクスの収集

アプリケーションのコンテナで、オートディスカバリーのインテグレーションテンプレートをポッドアノテーションとして設定します。または、ファイル、コンフィギュレーションマップ、または Key-Value ストアを使用してテンプレートを構成することもできます。

Annotations v1 (Datadog Agent < v7.36 向け)

apiVersion: v1
kind: Pod
metadata:
  name: coredns
  annotations:
    ad.datadoghq.com/coredns.check_names: '["coredns"]'
    ad.datadoghq.com/coredns.init_configs: '[{}]'
    ad.datadoghq.com/coredns.instances: |
      [
        {
          "openmetrics_endpoint": "http://%%host%%:9153/metrics", 
          "tags": ["dns-pod:%%host%%"]
        }
      ]      
  labels:
    name: coredns
spec:
  containers:
    - name: coredns

Annotations v2 (Datadog Agent v7.36 以降向け)

apiVersion: v1
kind: Pod
metadata:
  name: coredns
  annotations:
    ad.datadoghq.com/coredns.checks: |
      {
        "coredns": {
          "init_config": {},
          "instances": [
            {
              "openmetrics_endpoint": "http://%%host%%:9153/metrics", 
              "tags": ["dns-pod:%%host%%"]
            }
          ]
        }
      }      
  labels:
    name: coredns
spec:
  containers:
    - name: coredns

この OpenMetrics ベースのチェックのレガシーモードを有効にするには、openmetrics_endpointprometheus_url に置き換えます。

Annotations v1 (Datadog Agent < v7.36 向け)

    ad.datadoghq.com/coredns.instances: |
      [
        {
          "prometheus_url": "http://%%host%%:9153/metrics", 
          "tags": ["dns-pod:%%host%%"]
        }
      ]      

Annotations v2 (Datadog Agent v7.36 以降向け)

          "instances": [
            {
              "prometheus_url": "http://%%host%%:9153/metrics", 
              "tags": ["dns-pod:%%host%%"]
            }
          ]

:

  • 出荷時の coredns.d/auto_conf.yaml ファイルは、レガシーモードのデフォルトで prometheus_url オプションを有効にします。
  • dns-pod タグは、対象の DNS ポッド IP を追跡します。他のタグは、サービスディスカバリーを使用して情報をポーリングする Datadog Agent に関連します。
  • ポッドでサービスディスカバリーアノテーションを実行する必要があります。デプロイの場合は、テンプレートの仕様のメタデータにアノテーションを追加します。外側のレベルの仕様には追加しないでください。

収集データ

Datadog Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、Kubernetes ログ収集を参照してください。

次に、ログインテグレーションをポッドアノテーションとして設定します。または、ファイル、コンフィギュレーションマップ、または Key-Value ストアを使用してこれを構成することもできます。

Annotations v1/v2

apiVersion: v1
kind: Pod
metadata:
  name: coredns
  annotations:
    ad.datadoghq.com/coredns.logs: '[{"source": "coredns", "service": "<SERVICE_NAME>"}]'
  labels:
    name: coredns

ECS

このチェックを、ECS で実行している Agent に構成するには:

メトリクスの収集

アプリケーションのコンテナで、オートディスカバリーのインテグレーションテンプレートを Docker ラベルとして設定します。

{
  "containerDefinitions": [{
    "name": "coredns",
    "image": "coredns:latest",
    "dockerLabels": {
      "com.datadoghq.ad.check_names": "[\"coredns\"]",
      "com.datadoghq.ad.init_configs": "[{}]",
      "com.datadoghq.ad.instances": "[{\"openmetrics_endpoint\":\"http://%%host%%:9153/metrics\", \"tags\":[\"dns-pod:%%host%%\"]}]"
    }
  }]
}

この OpenMetrics ベースのチェックのレガシーモードを有効にするには、openmetrics_endpointprometheus_url に置き換えます。

      "com.datadoghq.ad.instances": "[{\"prometheus_url\":\"http://%%host%%:9153/metrics\", \"tags\":[\"dns-pod:%%host%%\"]}]"

:

  • 出荷時の coredns.d/auto_conf.yaml ファイルは、レガシーモードのデフォルトで prometheus_url オプションを有効にします。
  • dns-pod タグは、対象の DNS ポッド IP を追跡します。他のタグは、サービスディスカバリーを使用して情報をポーリングする Datadog Agent に関連します。
  • ポッドでサービスディスカバリーアノテーションを実行する必要があります。デプロイの場合は、テンプレートの仕様のメタデータにアノテーションを追加します。外側のレベルの仕様には追加しないでください。
収集データ

Datadog Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、ECS ログ収集を参照してください。

次に、ログインテグレーションを Docker ラベルとして設定します。

{
  "containerDefinitions": [{
    "name": "coredns",
    "image": "coredns:latest",
    "dockerLabels": {
      "com.datadoghq.ad.logs": "[{\"source\":\"coredns\",\"service\":\"<SERVICE_NAME>\"}]"
    }
  }]
}

検証

Agent の status サブコマンドを実行し、Checks セクションで coredns を探します。

リアルユーザーモニタリング

データセキュリティ

coredns.acl.allowed_requests
(count)
[OpenMetrics V1] Counter of DNS requests being allowed.
Shown as request
coredns.acl.allowed_requests.count
(count)
[OpenMetrics V2] Counter of DNS requests being allowed.
Shown as request
coredns.acl.blocked_requests
(count)
[OpenMetrics V1] Counter of DNS requests being blocked.
Shown as request
coredns.acl.blocked_requests.count
(count)
[OpenMetrics V2] Counter of DNS requests being blocked.
Shown as request
coredns.autopath.success_count
(count)
[OpenMetrics V1] Counter of requests that did autopath.
Shown as request
coredns.autopath.success_count.count
(count)
[OpenMetrics V2] Counter of requests that did autopath.
Shown as request
coredns.build_info
(gauge)
[OpenMetrics V1 and V2] A metric with a constant '1' value labeled by version, revision, and goversion from which CoreDNS was built.
coredns.cache_drops_count
(count)
[OpenMetrics V1] Counter of responses excluded from the cache due to request/response question name mismatch.
Shown as response
coredns.cache_drops_count.count
(count)
[OpenMetrics V2] Counter of responses excluded from the cache due to request/response question name mismatch.
Shown as response
coredns.cache_hits_count
(count)
[OpenMetrics V1] Counter of cache hits by cache type
Shown as hit
coredns.cache_hits_count.count
(count)
[OpenMetrics V2] Counter of cache hits by cache type
Shown as hit
coredns.cache_misses_count
(count)
[OpenMetrics V1] Counter of cache misses.
Shown as miss
coredns.cache_misses_count.count
(count)
[OpenMetrics V2] Counter of cache misses.
Shown as miss
coredns.cache_prefetch_count
(count)
[OpenMetrics V1] The number of time the cache has prefetched a cached item.
coredns.cache_prefetch_count.count
(count)
[OpenMetrics V2] The number of time the cache has prefetched a cached item.
coredns.cache_request_count
(count)
[OpenMetrics V1] Counter of cache requests.
Shown as request
coredns.cache_request_count.count
(count)
[OpenMetrics V2] Counter of cache requests.
Shown as request
coredns.cache_size.count
(gauge)
[OpenMetrics V1 and V2]
Shown as entry
coredns.cache_stale_count
(count)
[OpenMetrics V1] Counter of requests served from stale cache entries.
Shown as request
coredns.cache_stale_count.count
(count)
[OpenMetrics V2] Counter of requests served from stale cache entries.
Shown as request
coredns.dnssec.cache_hits
(count)
[OpenMetrics V1] Counter of cache hits.
Shown as hit
coredns.dnssec.cache_hits.count
(count)
[OpenMetrics V2] Counter of cache hits.
Shown as hit
coredns.dnssec.cache_misses
(count)
[OpenMetrics V1] Counter of cache misses.
Shown as miss
coredns.dnssec.cache_misses.count
(count)
[OpenMetrics V2] Counter of cache misses.
Shown as miss
coredns.dnssec.cache_size
(gauge)
[OpenMetrics V1 and V2] Total elements in the cache, type is signature.
coredns.forward_healthcheck_broken_count
(count)
[OpenMetrics V1] counter of when all upstreams are unhealthy
Shown as entry
coredns.forward_healthcheck_broken_count.count
(count)
[OpenMetrics V2] counter of when all upstreams are unhealthy
Shown as entry
coredns.forward_healthcheck_failure_count
(count)
[OpenMetrics V1] number of failed health checks per upstream
Shown as entry
coredns.forward_healthcheck_failure_count.count
(count)
[OpenMetrics V2] number of failed health checks per upstream
Shown as entry
coredns.forward_max_concurrent_rejects
(count)
[OpenMetrics V1] Counter of the number of queries rejected because the concurrent queries were at maximum.
Shown as query
coredns.forward_max_concurrent_rejects.count
(count)
[OpenMetrics V2] Counter of the number of queries rejected because the concurrent queries were at maximum.
Shown as query
coredns.forward_request_count
(count)
[OpenMetrics V1] query count per upstream
Shown as request
coredns.forward_request_count.count
(count)
[OpenMetrics V2] query count per upstream
Shown as request
coredns.forward_request_duration.seconds.bucket
(count)
[OpenMetrics V2] duration per upstream interaction
Shown as second
coredns.forward_request_duration.seconds.count
(count)
[OpenMetrics V1 and V2] duration per upstream interaction
Shown as second
coredns.forward_request_duration.seconds.sum
(count)
[OpenMetrics V1 and V2] duration per upstream interaction
Shown as second
coredns.forward_response_rcode_count
(count)
[OpenMetrics V1] count of RCODEs per upstream
Shown as response
coredns.forward_response_rcode_count.count
(count)
[OpenMetrics V2] count of RCODEs per upstream
Shown as response
coredns.forward_sockets_open
(gauge)
[OpenMetrics V1 and V2] number of sockets open per upstream
Shown as connection
coredns.go.gc_duration_seconds.count
(count)
[OpenMetrics V1 and V2] Count of the GC invocation durations.
Shown as second
coredns.go.gc_duration_seconds.quantile
(gauge)
[OpenMetrics V1 and V2] Quantiles of the GC invocation durations.
Shown as second
coredns.go.gc_duration_seconds.sum
(count)
[OpenMetrics V1 and V2] Sum of the GC invocation durations.
Shown as second
coredns.go.goroutines
(gauge)
[OpenMetrics V1 and V2] Number of goroutines that currently exist.
Shown as thread
coredns.go.info
(gauge)
[OpenMetrics V1 and V2] Information about the Go environment.
coredns.go.memstats.alloc_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes allocated and still in use.
Shown as byte
coredns.go.memstats.alloc_bytes_total
(count)
[OpenMetrics V1] Total number of bytes allocated even if freed.
Shown as byte
coredns.go.memstats.buck_hash_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used by the profiling bucket hash table.
Shown as byte
coredns.go.memstats.frees_total
(count)
[OpenMetrics V1] Total number of frees.
coredns.go.memstats.frees_total.count
(count)
[OpenMetrics V2] Total number of frees.
coredns.go.memstats.gc_cpu_fraction
(gauge)
[OpenMetrics V1 and V2] CPU taken up by GC
Shown as percent
coredns.go.memstats.gc_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used for garbage collection system metadata.
Shown as byte
coredns.go.memstats.heap_alloc_bytes
(gauge)
[OpenMetrics V1 and V2] Bytes allocated to the heap
Shown as byte
coredns.go.memstats.heap_idle_bytes
(gauge)
[OpenMetrics V1 and V2] Number of idle bytes in the heap
Shown as byte
coredns.go.memstats.heap_inuse_bytes
(gauge)
[OpenMetrics V1 and V2] Number of Bytes in the heap
Shown as byte
coredns.go.memstats.heap_objects
(gauge)
[OpenMetrics V1 and V2] Number of objects in the heap
Shown as object
coredns.go.memstats.heap_released_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes released to the system in the last gc
Shown as byte
coredns.go.memstats.heap_released_bytes.count
(count)
[OpenMetrics V2] Count of bytes released to the system in the last gc
Shown as byte
coredns.go.memstats.heap_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used by the heap
Shown as byte
coredns.go.memstats.last_gc_time_seconds
(gauge)
[OpenMetrics V1 and V2] Length of last GC
Shown as second
coredns.go.memstats.lookups_total
(count)
[OpenMetrics V1] Number of lookups
Shown as operation
coredns.go.memstats.lookups_total.count
(count)
[OpenMetrics V2] Number of lookups
Shown as operation
coredns.go.memstats.mallocs_total
(count)
[OpenMetrics V1] Number of mallocs
Shown as operation
coredns.go.memstats.mallocs_total.count
(count)
[OpenMetrics V2] Number of mallocs
Shown as operation
coredns.go.memstats.mcache_inuse_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes in use by mcache structures.
Shown as byte
coredns.go.memstats.mcache_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used for mcache structures obtained from system.
Shown as byte
coredns.go.memstats.mspan_inuse_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes in use by mspan structures.
Shown as byte
coredns.go.memstats.mspan_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used for mspan structures obtained from system.
Shown as byte
coredns.go.memstats.next_gc_bytes
(gauge)
[OpenMetrics V1 and V2] Number of heap bytes when next garbage collection will take place
Shown as byte
coredns.go.memstats.other_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes used for other system allocations
Shown as byte
coredns.go.memstats.stack_inuse_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes in use by the stack allocator
Shown as byte
coredns.go.memstats.stack_sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes obtained from system for stack allocator
Shown as byte
coredns.go.memstats.sys_bytes
(gauge)
[OpenMetrics V1 and V2] Number of bytes obtained from system
Shown as byte
coredns.go.threads
(gauge)
[OpenMetrics V1 and V2] Number of OS threads created.
Shown as thread
coredns.grpc.request_count
(count)
[OpenMetrics V1] Query count per upstream.
coredns.grpc.request_count.count
(count)
[OpenMetrics V2] Query count per upstream.
coredns.grpc.response_rcode_count
(count)
[OpenMetrics V1] Count of RCODEs per upstream. and we are randomly (this always uses the random policy) spraying to an upstream.
coredns.grpc.response_rcode_count.count
(count)
[OpenMetrics V2] Count of RCODEs per upstream. and we are randomly (this always uses the random policy) spraying to an upstream.
coredns.health_request_duration.bucket
(count)
[OpenMetrics V2] Sample for the histogram of the time (in seconds) each request took.
coredns.health_request_duration.count
(count)
[OpenMetrics V1 and V2] Count for the histogram of the time (in seconds) each request took.
coredns.health_request_duration.sum
(count)
[OpenMetrics V1 and V2] Sum for the histogram of the time (in seconds) each request took.
coredns.hosts.entries_count
(gauge)
[OpenMetrics V1 and V2] The combined number of entries in hosts and Corefile.
coredns.hosts.reload_timestamp
(gauge)
[OpenMetrics V1 and V2] The timestamp of the last reload of hosts file.
Shown as second
coredns.panic_count.count
(count)
[OpenMetrics V1 and V2]
Shown as entry
coredns.plugin_enabled
(gauge)
[OpenMetrics V1 and V2] A metric that indicates whether a plugin is enabled on per server and zone basis.
coredns.process.cpu_seconds_total
(count)
[OpenMetrics V1 and V2] Total user and system CPU time spent in seconds.
Shown as second
coredns.process.cpu_seconds_total.count
(count)
[OpenMetrics V2] Count of user and system CPU time spent in seconds.
Shown as second
coredns.process.max_fds
(gauge)
[OpenMetrics V1 and V2] Maximum number of open file descriptors.
Shown as file
coredns.process.open_fds
(gauge)
[OpenMetrics V1 and V2] Number of open file descriptors.
Shown as file
coredns.process.resident_memory_bytes
(gauge)
[OpenMetrics V1 and V2] Resident memory size in bytes.
Shown as byte
coredns.process.start_time_seconds
(gauge)
[OpenMetrics V1 and V2] Start time of the process since unix epoch in seconds.
Shown as second
coredns.process.virtual_memory_bytes
(gauge)
[OpenMetrics V1 and V2] Virtual memory size in bytes.
Shown as byte
coredns.proxy_request_count
(count)
[OpenMetrics V1] query count per upstream.
Shown as request
coredns.proxy_request_count.count
(count)
[OpenMetrics V2] query count per upstream.
Shown as request
coredns.proxy_request_duration.seconds.bucket
(count)
[OpenMetrics V2] sample of duration per upstream interaction
Shown as second
coredns.proxy_request_duration.seconds.count
(count)
[OpenMetrics V1 and V2] duration per upstream interaction
Shown as second
coredns.proxy_request_duration.seconds.sum
(count)
[OpenMetrics V1 and V2] duration per upstream interaction
Shown as second
coredns.reload.failed_count
(count)
[OpenMetrics V1] Counts the number of failed reload attempts.
coredns.reload.failed_count.count
(count)
[OpenMetrics V2] Counts the number of failed reload attempts.
coredns.request_count
(count)
[OpenMetrics V1] total query count.
Shown as request
coredns.request_count.count
(count)
[OpenMetrics V2] total query count.
Shown as request
coredns.request_duration.seconds.bucket
(count)
[OpenMetrics V2] sample duration to process each query
Shown as second
coredns.request_duration.seconds.count
(count)
[OpenMetrics V1 and V2] duration to process each query
Shown as second
coredns.request_duration.seconds.sum
(count)
[OpenMetrics V1 and V2] duration to process each query
Shown as second
coredns.request_size.bytes.bucket
(count)
[OpenMetrics V2] sample size of the request in bytes
Shown as byte
coredns.request_size.bytes.count
(count)
[OpenMetrics V1 and V2] size of the request in bytes
Shown as byte
coredns.request_size.bytes.sum
(count)
[OpenMetrics V1 and V2] size of the request in bytes
Shown as byte
coredns.request_type_count
(count)
[OpenMetrics V1] counter of queries per zone and type
coredns.request_type_count.count
(count)
[OpenMetrics V2] counter of queries per zone and type
coredns.response_code_count
(count)
[OpenMetrics V1] number of responses per zone and rcode
coredns.response_code_count.count
(count)
[OpenMetrics V2] number of responses per zone and rcode
coredns.response_size.bytes.bucket
(count)
[OpenMetrics V2] sample size of the request in bytes
Shown as byte
coredns.response_size.bytes.count
(count)
[OpenMetrics V1 and V2] size of the request in bytes
Shown as byte
coredns.response_size.bytes.sum
(count)
[OpenMetrics V1 and V2] size of the request in bytes
Shown as byte
coredns.template.failures_count
(count)
[OpenMetrics V1] The number of times the Go templating failed.
Shown as error
coredns.template.failures_count.count
(count)
[OpenMetrics V2] The number of times the Go templating failed.
Shown as error
coredns.template.matches_count
(count)
[OpenMetrics V1] The total number of matched requests by regex.
coredns.template.matches_count.count
(count)
[OpenMetrics V2] The total number of matched requests by regex.
coredns.template.rr_failures_count
(count)
[OpenMetrics V1] The number of times the templated resource record was invalid and could not be parsed.
Shown as error
coredns.template.rr_failures_count.count
(count)
[OpenMetrics V2] The number of times the templated resource record was invalid and could not be parsed.
Shown as error

ヘルプ

CoreDNS チェックには、イベントは含まれません。

ヘルプ

coredns.prometheus.health
Returns CRITICAL if the check cannot access the metrics endpoint. Returns OK otherwise.
Statuses: ok, critical

ヘルプ

ご不明な点は、Datadog のサポートチームまでお問合せください。

その他の参考資料

お役に立つドキュメント、リンクや記事: