Supported OS Linux Windows Mac OS

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

To find out if this integration is available in your organization, see your Datadog Integrations page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email support@ddog-gov.com.

概要

Agent の Kong チェックは、合計リクエスト数、応答コード数、クライアント接続数などを追跡します。

また、Kong の Datadog プラグインを使用すると、DogStatsD を使用して Datadog Agent を通じて Datadog に API、接続、データベースメトリクスを送信することができます。詳しくは、Datadog インテグレーションによる Kong の監視のブログ投稿をお読みください。

セットアップ

インストール

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

構成

ホスト

ホストで実行中の Agent に対してこのチェックを構成するには

メトリクスの収集
  1. Prometheus プラグインを有効にすることで、OpenMetrics のメトリクスが Kong サービスで公開されることを確認します。これは、Agent が Kong のメトリクスを収集する前に、最初に構成する必要があります。

  2. Kong メトリクスの収集を開始するには、Agent の構成ディレクトリのルートにある conf.d/ フォルダーの kong.d/conf.yaml ファイルにこの構成ブロックを追加します。使用可能なすべての構成オプションについては、サンプル kong.d/conf.yaml を参照してください。

    init_config:
    
    instances:
      ## @param openmetrics_endpoint - 文字列 - 必須
      ## OpenMetrics 形式のメトリクスを公開するURL。
      #
      - openmetrics_endpoint: http://localhost:8001/metrics
    
  3. Agent を再起動します

: 現在のバージョンのチェック (1.17.0+) は、メトリクスの収集に OpenMetrics を使用しており、これは Python 3 を必要とします。Python 3 を使用できないホスト、またはこのチェックのレガシーバージョンを使用する場合は、次の構成を参照してください。

ログ収集

Agent バージョン 6.0 以降で利用可能

Kong アクセスログは NGINX によって生成されます。したがって、デフォルトの場所は NGINX ファイルと同じです。

  1. Datadog Agent で、ログの収集はデフォルトで無効になっています。以下のように、datadog.yaml ファイルでこれを有効にします。

    logs_enabled: true
    
  2. Kong のログの収集を開始するには、次の構成ブロックを kong.d/conf.yaml ファイルに追加します。

    logs:
      - type: file
        path: /var/log/nginx/access.log
        service: '<SERVICE>'
        source: kong
    
      - type: file
        path: /var/log/nginx/error.log
        service: '<SERVICE>'
        source: kong
    

    path パラメーターと service パラメーターの値を変更し、環境に合わせて構成してください。使用可能なすべての構成オプションの詳細については、サンプル kong.d/conf.yaml を参照してください。

  3. Agent を再起動します

コンテナ化

Prometheus プラグインを有効にすることで、OpenMetrics のメトリクスが Kong サービスで公開されることを確認します。これは、Agent が Kong のメトリクスを収集する前に、最初に構成する必要があります。 コンテナ環境では、オートディスカバリーインテグレーションテンプレートを参照して、以下のパラメーターを適用するためのガイダンスを確認してください。

メトリクスの収集
パラメーター
<INTEGRATION_NAME>kong
<INIT_CONFIG>空白または {}
<INSTANCE_CONFIG>{"openmetrics_endpoint": "http://%%host%%:8001/metrics"}
ログ収集

Agent バージョン 6.0 以降で利用可能

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

パラメーター
<LOG_CONFIG>{"source": "kong", "service": "<サービス名>"}

検証

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

収集データ

メトリクス

kong.bandwidth.bytes.count
(count)
[OpenMetrics V2] (Kong v3+) The total bandwidth in bytes consumed per service/route in Kong
Shown as byte
kong.bandwidth.count
(count)
[OpenMetrics V2] (Kong < 3) The total bandwidth in bytes consumed per service/route in Kong
Shown as byte
kong.connections_accepted
(gauge)
[Legacy] Total number of accepted client connections.
Shown as connection
kong.connections_active
(gauge)
[Legacy] Current number of active client connections including Waiting connections.
Shown as connection
kong.connections_handled
(gauge)
[Legacy] Total number of handled connections. (Same as accepts unless resource limits were reached).
Shown as connection
kong.connections_reading
(gauge)
[Legacy] Current number of connections where Kong is reading the request header.
Shown as connection
kong.connections_waiting
(gauge)
[Legacy] Current number of idle client connections waiting for a request.
Shown as connection
kong.connections_writing
(gauge)
[Legacy] Current number of connections where nginx is writing the response back to the client.
Shown as connection
kong.http.consumer.status.count
(count)
[OpenMetrics V2] (Kong < 3) HTTP status codes for customer per service/route in Kong
Shown as request
kong.http.requests.count
(count)
[OpenMetrics V2] (Kong v3+) Http Status codes per service/route in Kong
Shown as request
kong.http.status
(count)
[OpenMetrics V2] (Kong < 3) HTTP status codes per service/route in Kong
Shown as request
kong.kong.latency.ms.bucket
(count)
[OpenMetrics V2] (Kong v3+) The latency of Kong specificially
Shown as millisecond
kong.kong.latency.ms.count
(count)
[OpenMetrics V2] (Kong v3+) The latency of Kong specifically
Shown as millisecond
kong.kong.latency.ms.sum
(count)
[OpenMetrics V2] (Kong v3+) The latency of Kong specifically
Shown as millisecond
kong.latency.bucket
(count)
[OpenMetrics V2] (Kong < 3) The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.latency.count
(count)
[OpenMetrics V2] (Kong < 3) The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.latency.sum
(count)
[OpenMetrics V2] (Kong < 3) The latency added by Kong, total request time and upstream latency for each service/route in Kong
Shown as millisecond
kong.memory.lua.shared_dict.bytes
(gauge)
[OpenMetrics V2] The allocated slabs in bytes in a shared_dict
Shown as byte
kong.memory.lua.shared_dict.total_bytes
(gauge)
[OpenMetrics V2] The total capacity in bytes of a shared_dict
Shown as byte
kong.memory.workers.lua.vms.bytes
(gauge)
[OpenMetrics V2] The allocated bytes in worker Lua VM
Shown as byte
kong.nginx.connections.total
(gauge)
[OpenMetrics V2] (Kong v3+) The number of HTTP and stream connections
Shown as connection
kong.nginx.http.current_connections
(gauge)
[OpenMetrics V2] (Kong < 3) The number of HTTP connections
Shown as connection
kong.nginx.requests.total
(gauge)
[OpenMetrics V2] (Kong v3+) The number of total Nginx connections
Shown as request
kong.nginx.stream.current_connections
(gauge)
[OpenMetrics V2] (Kong < 3) The number of stream connections
Shown as connection
kong.nginx.timers
(gauge)
[OpenMetrics v2] (Kong v2.8+) Total number of Nginx timers in Running or Pending state.
Shown as item
kong.request.latency.ms.bucket
(count)
[OpenMetrics V2] (Kong v3+) The latency added by Kong to requests
Shown as millisecond
kong.request.latency.ms.count
(count)
[OpenMetrics V2] (Kong v3+) The latency added by Kong to requests
Shown as millisecond
kong.request.latency.ms.sum
(count)
[OpenMetrics V2] (Kong v3+) The latency added by Kong to requests
Shown as millisecond
kong.session.duration.ms
(count)
[OpenMetrics V2] (Kong v3+) The duration of a Kong stream
Shown as millisecond
kong.stream.status.count
(count)
[OpenMetrics V2] The stream status codes per service/route in Kong
Shown as request
kong.total_requests
(gauge)
[Legacy] Total number of client requests.
Shown as request
kong.upstream.latency.ms.bucket
(count)
[OpenMetrics V2] (Kong v3+) The upstream latency added by Kong
Shown as millisecond
kong.upstream.latency.ms.count
(count)
[OpenMetrics V2] (Kong v3+) The upstream latency added by Kong
Shown as millisecond
kong.upstream.latency.ms.sum
(count)
[OpenMetrics V2] (Kong v3+) The upstream latency added by Kong
Shown as millisecond

イベント

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

サービスチェック

kong.can_connect

Returns CRITICAL if the Agent is unable to connect to the Kong instance. Returns OK otherwise.

Statuses: ok, critical

kong.openmetrics.health

Returns CRITICAL if the Agent is unable to connect to the OpenMetrics endpoint, otherwise returns OK.

Statuses: ok, critical

kong.datastore.reachable

Returns CRITICAL if Kong is unable to connect to the datastore, otherwise returns OK.

Statuses: ok, critical

kong.upstream.target.health

Returns CRITICAL if the target is unhealthy, otherwise returns OK.

Statuses: ok, critical

トラブルシューティング

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

その他の参考資料