Supported OS Linux Windows Mac OS

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

NGINX のデフォルトのダッシュボード

概要

Datadog Agent は NGINX インスタンスから、次のような多数のメトリクスを収集できます (一例)。

  • 合計リクエスト数
  • 接続数 (許可された接続、処理された接続、アクティブな接続など)

NGINX の商用版である NGINX Plus のユーザーの場合、Agent は、NGINX Plus が提供する次のような数多くのメトリクスを収集できます。

  • エラー (4xx コード、5xx コードなど)
  • 上流サーバー (アクティブな接続、5xx コード、健全性チェックなど)
  • キャッシュ (サイズ、ヒット数、ミス数など)
  • SSL (ハンドシェイクやハンドシェイクの失敗など)

セットアップ

インストール

NGINX チェックは、ローカルの NGINX ステータスエンドポイントからメトリクスを取得するため、nginx バイナリが NGINX ステータスモジュールと共にコンパイルされている必要があります。

NGINX オープンソース

オープンソース NGINX を使用している場合は、インスタンスにスタブステータスモジュールが含まれていないことがあります。コンフィグレーションを行う前に、nginx バイナリにモジュールが含まれているかを確認してください。

$ nginx -V 2>&1| grep -o http_stub_status_module
http_stub_status_module

コマンドの出力に http_stub_status_module が含まれていない場合は、このモジュールを含む NGINX パッケージをインストールする必要があります。独自の NGINX をコンパイルして、コンパイル時にモジュールを有効化することもできますが、最新の Linux ディストリビューションで提供されている代替 NGINX パッケージには、外部モジュールのさまざまな組み合わせが組み込まれています。ご使用のオペレーティングシステムの NGINX パッケージをチェックして、スタブステータスモジュールが含まれているパッケージを探してください。

NGINX Plus

リリース 13 より前の NGINX Plus パッケージにはHTTP ステータスモジュールが含まれています。リリース 13 以降の NGINX Plus では、このステータスモジュールは非推奨になり、代わりに新しい Plus API を使用する必要があります。詳細については、こちらのお知らせを参照してください。

NGINX の準備

各 NGINX サーバーで、他の NGINX 構成ファイルが含まれているディレクトリ (/etc/nginx/conf.d/ など) に status.conf ファイルを作成します。

server {
  listen 81;
  server_name localhost;

  access_log off;
  allow 127.0.0.1;
  deny all;

  location /nginx_status {
    # ステータスモジュールを選択します

    # オープンソース NGINX を自由に利用できます
    stub_status;

    # バージョン 1.7.5 以前の オープンソース NGINX で使用します
    # stub_status on;

    # NGINX Plus でのみ使用できます
    # status;

   # バージョン情報を取得できるようにします
   server_tokens on;
  }
}

NGINX Plus

NGINX Plus ユーザーは、stub_status を使用することもできますが、このモジュールで提供されるメトリクスは少ないため、status の使用をお勧めします。

NGINX Plus リリース 15 以降では、status モジュールは非推奨です。代わりに http_api_module を使用してください。たとえば、メインの NGINX 構成ファイル (/etc/nginx/conf.d/default.conf) で /api エンドポイントを有効にするには、以下のようにします。

server {
  listen 8080;
  location /api {
    api write=on;
  }
}

NGINX Plus を使用してさらに詳細なメトリクス (毎秒の 2xx / 3xx / 4xx / 5xx 応答数など) を取得するには、監視するサーバーで status_zone を設定します。たとえば、以下のとおりです。

server {
  listen 80;
  status_zone <ゾーン名>;
  ...
}

NGINX をリロードして、status または API エンドポイントを有効にします。完全な再起動は必要ありません。

sudo nginx -t && sudo nginx -s reload

以下のスニペットを構成 ConfigMaps に追加し、別のポートでメトリクスエンドポイントを公開します。

kind: ConfigMap
metadata:
  name: nginx-conf
data:
[...]
  status.conf: |
    server {
      listen 81;

      location /nginx_status {
        stub_status on;
      }

      location / {
        return 404;
      }
    }    

次に、NGINX ポッドで 81 エンドポイントを公開し、そのファイルを NGINX 構成フォルダーにマウントします。

spec:
  containers:
    - name: nginx
      ports:
        - containerPort: 81
      volumeMounts:
        - mountPath: /etc/nginx/conf.d/status.conf
          subPath: status.conf
          readOnly: true
          name: "config"
  volumes:
    - name: "config"
      configMap:
          name: "nginx-conf"

構成

ホスト

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

ホストで実行されている Agent 用にこのチェックを構成する場合は、以下の手順に従ってください。コンテナ環境の場合は、DockerKubernetes、または ECS セクションを参照してください。

メトリクスの収集
  1. NGINX メトリクスの収集を開始するには、nginx.d/conf.yaml ファイルで nginx_status_url パラメーターを http://localhost:81/nginx_status/ に設定します。使用可能なすべての構成オプションの詳細については、サンプル nginx.d/conf.yaml を参照してください。

    NGINX Plus:

    • NGINX Plus リリース 13 以降の場合は、nginx.d/conf.yaml 構成ファイルでパラメーター use_plus_apitrue に設定します。

    • ストリーム統計 API 呼び出しは、NGINX Plus のデフォルトで含まれています。これを無効にしたい場合は、nginx.d/conf.yaml コンフィギュレーションファイルでパラメーター use_plus_api_streamfalse に設定します。

    • http_api_module を使用する場合は、nginx.d/conf.yaml 構成ファイルでパラメーター nginx_status_url をサーバーの /api の場所に設定します。以下に例を示します。

      nginx_status_url: http://localhost:8080/api
      
  2. オプション - NGINX の vhost_traffic_status module を使用する場合は、nginx.d/conf.yaml 構成ファイルでパラメーター use_vtstrue に設定します。

  3. Agent を再起動すると、Datadog への NGINX メトリクスの送信が開始されます。

ログ収集

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

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

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

    logs:
      - type: file
        path: /var/log/nginx/access.log
        service: nginx
        source: nginx
    
      - type: file
        path: /var/log/nginx/error.log
        service: nginx
        source: nginx
    

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

  3. Agent を再起動します

: NGINX のデフォルトのログ形式には、リクエスト応答時間が含まれていません。これをログに含めるには、NGINX 構成ファイル (/etc/nginx/nginx.conf) の http セクションに以下の構成ブロックを追加して、NGINX のログ形式を更新します。

http {
    #推奨ログフォーマット
    log_format nginx '\$remote_addr - \$remote_user [\$time_local] '
                  '"\$request" \$status \$body_bytes_sent \$request_time '
                  '"\$http_referer" "\$http_user_agent"';

    access_log /var/log/nginx/access.log;
}

Docker

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

メトリクスの収集

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

LABEL "com.datadoghq.ad.check_names"='["nginx"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"nginx_status_url": "http://%%host%%:81/nginx_status/"}]'

: このインスタンスは NGINX オープンソースでのみ機能します。NGINX Plus を使用している場合は、対応するインスタンス構成をインライン化します。

ログ収集

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

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

LABEL "com.datadoghq.ad.logs"='[{"source":"nginx","service":"nginx"}]'

Kubernetes

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

メトリクスの収集

To collect metrics, set the following parameters and values in an Autodiscovery template. You can do this with Kubernetes Annotations (shown below) on your NGINX pod(s), or with a local file, ConfigMap, key-value store, Datadog Operator manifest, or Helm chart.

パラメーター
<INTEGRATION_NAME>["nginx"]
<INIT_CONFIG>[{}]
<INSTANCE_CONFIG>[{"nginx_status_url": "http://%%host%%:18080/nginx_status"}]

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

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  annotations:
    ad.datadoghq.com/nginx.check_names: '["nginx"]'
    ad.datadoghq.com/nginx.init_configs: '[{}]'
    ad.datadoghq.com/nginx.instances: |
      [
        {
          "nginx_status_url":"http://%%host%%:81/nginx_status/"
        }
      ]      
  labels:
    name: nginx

Annotations v2 (Datadog Agent v7.36+ 向け)

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  annotations:
    ad.datadoghq.com/nginx.checks: |
      {
        "nginx": {
          "init_config": {},
          "instances": [
            {
              "nginx_status_url":"http://%%host%%:81/nginx_status/"
            }
          ]
        }
      }      
  labels:
    name: nginx

: このインスタンスは NGINX オープンソースでのみ機能します。NGINX Plus を使用している場合は、対応するインスタンス構成をインライン化します。

ログ収集

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

Then, set the following parameter in an Autodiscovery template. You can do this with Kubernetes Annotations (shown below) on your Redis pod(s), or with a local file, ConfigMap, key-value store, Datadog Operator manifest, or Helm chart.

パラメーター
<LOG_CONFIG>[{"source":"nginx","service":"nginx"}]

Annotations v1/v2

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

ECS

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

メトリクスの収集

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

{
  "containerDefinitions": [{
    "name": "nginx",
    "image": "nginx:latest",
    "dockerLabels": {
      "com.datadoghq.ad.check_names": "[\"nginx\"]",
      "com.datadoghq.ad.init_configs": "[{}]",
      "com.datadoghq.ad.instances": "[{\"nginx_status_url\":\"http://%%host%%:81/nginx_status/\"}]"
    }
  }]
}

: このインスタンスは NGINX オープンソースでのみ機能します。NGINX Plus を使用している場合は、対応するインスタンス構成をインライン化します。

ログ収集

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

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

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

検証

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

収集データ

メトリクス

nginx.cache.bypass.bytes
(gauge)
The total number of bytes read from the proxied server
Shown as byte
nginx.cache.bypass.bytes_count
(count)
The total number of bytes read from the proxied server (shown as count)
Shown as byte
nginx.cache.bypass.bytes_written
(gauge)
The total number of bytes written to the cache
Shown as byte
nginx.cache.bypass.bytes_written_count
(count)
The total number of bytes written to the cache (shown as count)
Shown as byte
nginx.cache.bypass.responses
(gauge)
The total number of responses not taken from the cache
Shown as response
nginx.cache.bypass.responses_count
(count)
The total number of responses not taken from the cache (shown as count)
Shown as response
nginx.cache.bypass.responses_written
(gauge)
The total number of responses written to the cache
Shown as response
nginx.cache.bypass.responses_written_count
(count)
The total number of responses written to the cache (shown as count)
Shown as response
nginx.cache.cold
(gauge)
A boolean value indicating whether the cache loader process is still loading data from disk into the cache
Shown as response
nginx.cache.expired.bytes
(gauge)
The total number of bytes read from the proxied server
Shown as byte
nginx.cache.expired.bytes_count
(count)
The total number of bytes read from the proxied server (shown as count)
Shown as byte
nginx.cache.expired.bytes_written
(gauge)
The total number of bytes written to the cache
Shown as byte
nginx.cache.expired.bytes_written_count
(count)
The total number of bytes written to the cache (shown as count)
Shown as byte
nginx.cache.expired.responses
(gauge)
The total number of responses not taken from the cache
Shown as response
nginx.cache.expired.responses_count
(count)
The total number of responses not taken from the cache (shown as count)
Shown as response
nginx.cache.expired.responses_written
(gauge)
The total number of responses written to the cache
Shown as response
nginx.cache.expired.responses_written_count
(count)
The total number of responses written to the cache (shown as count)
Shown as response
nginx.cache.hit.bytes
(gauge)
The total number of bytes read from the cache
Shown as byte
nginx.cache.hit.bytes_count
(count)
The total number of bytes read from the cache (shown as count)
Shown as byte
nginx.cache.hit.responses
(gauge)
The total number of responses read from the cache
Shown as response
nginx.cache.hit.responses_count
(count)
The total number of responses read from the cache (shown as count)
Shown as response
nginx.cache.max_size
(gauge)
The limit on the maximum size of the cache specified in the configuration
Shown as byte
nginx.cache.miss.bytes
(gauge)
The total number of bytes read from the proxied server
Shown as byte
nginx.cache.miss.bytes_count
(count)
The total number of bytes read from the proxied server (shown as count)
Shown as byte
nginx.cache.miss.bytes_written
(gauge)
The total number of bytes written to the cache
Shown as byte
nginx.cache.miss.bytes_written_count
(count)
The total number of bytes written to the cache (shown as count)
Shown as byte
nginx.cache.miss.responses
(gauge)
The total number of responses not taken from the cache
Shown as response
nginx.cache.miss.responses_count
(count)
The total number of responses not taken from the cache (shown as count)
Shown as response
nginx.cache.miss.responses_written
(gauge)
The total number of responses written to the cache
Shown as response
nginx.cache.miss.responses_written_count
(count)
The total number of responses written to the cache
Shown as response
nginx.cache.revalidated.bytes
(gauge)
The total number of bytes read from the cache
Shown as byte
nginx.cache.revalidated.bytes_count
(count)
The total number of bytes read from the cache (shown as count)
Shown as byte
nginx.cache.revalidated.responses
(gauge)
The total number of responses read from the cache
Shown as response
nginx.cache.revalidated.responses_count
(count)
The total number of responses read from the cache (shown as count)
Shown as response
nginx.cache.size
(gauge)
The current size of the cache
Shown as response
nginx.cache.stale.bytes
(gauge)
The total number of bytes read from the cache
Shown as byte
nginx.cache.stale.bytes_count
(count)
The total number of bytes read from the cache (shown as count)
Shown as byte
nginx.cache.stale.responses
(gauge)
The total number of responses read from the cache
Shown as response
nginx.cache.stale.responses_count
(count)
The total number of responses read from the cache (shown as count)
Shown as response
nginx.cache.updating.bytes
(gauge)
The total number of bytes read from the cache
Shown as byte
nginx.cache.updating.bytes_count
(count)
The total number of bytes read from the cache (shown as count)
Shown as byte
nginx.cache.updating.responses
(gauge)
The total number of responses read from the cache
Shown as response
nginx.cache.updating.responses_count
(count)
The total number of responses read from the cache (shown as count)
Shown as response
nginx.connections.accepted
(gauge)
The total number of accepted client connections.
Shown as connection
nginx.connections.accepted_count
(count)
The total number of accepted client connections (shown as count).
Shown as connection
nginx.connections.active
(gauge)
The current number of active client connections.
Shown as connection
nginx.connections.dropped
(gauge)
The total number of dropped client connections.
Shown as connection
nginx.connections.dropped_count
(count)
The total number of dropped client connections (shown as count).
Shown as connection
nginx.connections.idle
(gauge)
The current number of idle client connections.
Shown as connection
nginx.generation
(gauge)
The total number of configuration reloads
Shown as refresh
nginx.generation_count
(count)
The total number of configuration reloads (shown as count)
Shown as refresh
nginx.limit_conn.passed
(count)
The total number of connections that were neither limited nor accounted as limited.
Shown as connection
nginx.limit_conn.rejected
(count)
The total number of connections that were rejected.
Shown as connection
nginx.limit_conn.rejected_dry_run
(count)
The total number of connections accounted as rejected in the dry run mode.
Shown as connection
nginx.limit_req.delayed
(count)
The total number of requests that were delayed.
Shown as request
nginx.limit_req.delayed_dry_run
(count)
The total number of requests accounted as delayed in the dry run mode.
Shown as request
nginx.limit_req.passed
(count)
The total number of requests that were neither limited nor accounted as limited.
Shown as request
nginx.limit_req.rejected
(count)
The total number of requests that were rejected.
Shown as request
nginx.limit_req.rejected_dry_run
(count)
The total number of requests accounted as rejected in the dry run mode.
Shown as request
nginx.load_timestamp
(gauge)
Time of the last reload of configuration (time since Epoch).
Shown as millisecond
nginx.location_zone.discarded
(count)
The total number of requests completed without sending a response.
Shown as request
nginx.location_zone.received
(count)
The total number of bytes received from clients.
Shown as byte
nginx.location_zone.requests
(count)
The total number of client requests received from clients.
Shown as request
nginx.location_zone.responses.1xx
(count)
The total number of responses with 1xx status codes.
Shown as response
nginx.location_zone.responses.2xx
(count)
The total number of responses with 2xx status codes.
Shown as response
nginx.location_zone.responses.3xx
(count)
The total number of responses with 3xx status codes.
Shown as response
nginx.location_zone.responses.4xx
(count)
The total number of responses with 4xx status codes.
Shown as response
nginx.location_zone.responses.5xx
(count)
The total number of responses with 5xx status codes.
Shown as response
nginx.location_zone.responses.code
(count)
The total number of responses per each status code.
Shown as response
nginx.location_zone.responses.total
(count)
The total number of responses sent to clients.
Shown as response
nginx.location_zone.sent
(count)
The total number of bytes sent to clients.
Shown as byte
nginx.net.conn_dropped_per_s
(rate)
Rate of connections dropped.
Shown as connection
nginx.net.conn_opened_per_s
(rate)
Rate of connections opened.
Shown as connection
nginx.net.connections
(gauge)
The total number of active connections.
Shown as connection
nginx.net.reading
(gauge)
The number of connections reading client requests.
Shown as connection
nginx.net.request_per_s
(rate)
Rate of requests processed. Measures both successful and failed requests.
Shown as request
nginx.net.waiting
(gauge)
The number of keep-alive connections waiting for work.
Shown as connection
nginx.net.writing
(gauge)
The number of connections waiting on upstream responses and/or writing responses back to the client.
Shown as connection
nginx.pid
(gauge)
The ID of the worker process that handled status request.
nginx.ppid
(gauge)
The ID of the master process that started the worker process
nginx.processes.respawned
(gauge)
The total number of abnormally terminated and respawned child processes.
Shown as process
nginx.processes.respawned_count
(count)
The total number of abnormally terminated and respawned child processes (shown as count).
Shown as process
nginx.requests.current
(gauge)
The current number of client requests.
Shown as request
nginx.requests.total
(gauge)
The total number of client requests.
Shown as request
nginx.requests.total_count
(count)
The total number of client requests (shown as count).
Shown as request
nginx.resolver.requests.addr
(count)
The total number of requests to resolve addresses to names.
Shown as request
nginx.resolver.requests.name
(count)
The total number of requests to resolve names to addresses.
Shown as request
nginx.resolver.requests.srv
(count)
The total number of requests to resolve SRV records.
Shown as request
nginx.resolver.responses.formerr
(count)
The total number of FORMERR (Format error) responses.
Shown as response
nginx.resolver.responses.noerror
(count)
The total number of successful responses.
Shown as response
nginx.resolver.responses.notimp
(count)
The total number of NOTIMP (Unimplemented) responses.
Shown as response
nginx.resolver.responses.nxdomain
(count)
The total number of NXDOMAIN (Host not found) responses.
Shown as response
nginx.resolver.responses.refused
(count)
The total number of REFUSED (Operation refused) responses.
Shown as response
nginx.resolver.responses.servfail
(count)
The total number of SERVFAIL (Server failure) responses.
Shown as response
nginx.resolver.responses.timedout
(count)
The total number of timed out requests.
Shown as request
nginx.resolver.responses.unknown
(count)
The total number of requests completed with an unknown error.
Shown as request
nginx.server_zone.discarded
(gauge)
The total number of requests completed without sending a response.
Shown as request
nginx.server_zone.discarded_count
(count)
The total number of requests completed without sending a response (shown as count).
Shown as request
nginx.server_zone.processing
(gauge)
The number of client requests that are currently being processed.
Shown as request
nginx.server_zone.received
(gauge)
The total amount of data received from clients.
Shown as byte
nginx.server_zone.received_count
(count)
The total amount of data received from clients (shown as count).
Shown as byte
nginx.server_zone.requests
(gauge)
The total number of client requests received from clients.
Shown as request
nginx.server_zone.requests_count
(count)
The total number of client requests received from clients (shown as count).
Shown as request
nginx.server_zone.responses.1xx
(gauge)
The number of responses with 1xx status code.
Shown as response
nginx.server_zone.responses.1xx_count
(count)
The number of responses with 1xx status code (shown as count).
Shown as response
nginx.server_zone.responses.2xx
(gauge)
The number of responses with 2xx status code.
Shown as response
nginx.server_zone.responses.2xx_count
(count)
The number of responses with 2xx status code (shown as count).
Shown as response
nginx.server_zone.responses.3xx
(gauge)
The number of responses with 3xx status code.
Shown as response
nginx.server_zone.responses.3xx_count
(count)
The number of responses with 3xx status code (shown as count).
Shown as response
nginx.server_zone.responses.4xx
(gauge)
The number of responses with 4xx status code.
Shown as response
nginx.server_zone.responses.4xx_count
(count)
The number of responses with 4xx status code (shown as count).
Shown as response
nginx.server_zone.responses.5xx
(gauge)
The number of responses with 5xx status code.
Shown as response
nginx.server_zone.responses.5xx_count
(count)
The number of responses with 5xx status code (shown as count).
Shown as response
nginx.server_zone.responses.code
(count)
The total number of responses per each status code, tagged with status code number.
Shown as response
nginx.server_zone.responses.total
(gauge)
The total number of responses sent to clients.
Shown as response
nginx.server_zone.responses.total_count
(count)
The total number of responses sent to clients (shown as count).
Shown as response
nginx.server_zone.sent
(gauge)
The total amount of data sent to clients.
Shown as byte
nginx.server_zone.sent_count
(count)
The total amount of data sent to clients (shown as count).
Shown as byte
nginx.slab.pages.free
(gauge)
The current number of free memory pages
Shown as page
nginx.slab.pages.used
(gauge)
The current number of used memory pages
Shown as page
nginx.slab.slot.fails
(gauge)
The number of unsuccessful attempts to allocate memory of specified size
Shown as request
nginx.slab.slot.fails_count
(count)
The number of unsuccessful attempts to allocate memory of specified size (shown as count)
Shown as request
nginx.slab.slot.free
(gauge)
The current number of free memory slots
nginx.slab.slot.reqs
(gauge)
The total number of attempts to allocate memory of specified size
Shown as request
nginx.slab.slot.reqs_count
(count)
The total number of attempts to allocate memory of specified size (shown as count)
Shown as request
nginx.slab.slot.used
(gauge)
The current number of used memory slots
nginx.ssl.handshakes
(gauge)
The total number of successful SSL handshakes.
nginx.ssl.handshakes_count
(count)
The total number of successful SSL handshakes (shown as count).
nginx.ssl.handshakes_failed
(gauge)
The total number of failed SSL handshakes.
nginx.ssl.handshakes_failed_count
(count)
The total number of failed SSL handshakes (shown as count).
nginx.ssl.session_reuses
(gauge)
The total number of session reuses during SSL handshake.
nginx.ssl.session_reuses_count
(count)
The total number of session reuses during SSL handshake (shown as count).
nginx.stream.limit_conn.passed
(count)
The total number of connections that were neither limited nor accounted as limited.
Shown as connection
nginx.stream.limit_conn.rejected
(count)
The total number of connections that were rejected.
Shown as connection
nginx.stream.limit_conn.rejected_dry_run
(count)
The total number of connections accounted as rejected in the dry run mode.
Shown as connection
nginx.stream.server_zone.connections
(gauge)
The total number of connections accepted from clients
Shown as connection
nginx.stream.server_zone.connections_count
(count)
The total number of connections accepted from clients (shown as count)
Shown as connection
nginx.stream.server_zone.discarded
(gauge)
The total number of requests completed without sending a response.
Shown as request
nginx.stream.server_zone.discarded_count
(count)
The total number of requests completed without sending a response (shown as count).
Shown as request
nginx.stream.server_zone.processing
(gauge)
The number of client requests that are currently being processed.
Shown as request
nginx.stream.server_zone.received
(gauge)
The total amount of data received from clients.
Shown as byte
nginx.stream.server_zone.received_count
(count)
The total amount of data received from clients (shown as count).
Shown as byte
nginx.stream.server_zone.sent
(gauge)
The total amount of data sent to clients.
Shown as byte
nginx.stream.server_zone.sent_count
(count)
The total amount of data sent to clients (shown as count).
Shown as byte
nginx.stream.server_zone.sessions.2xx
(gauge)
The number of responses with 2xx status code.
Shown as session
nginx.stream.server_zone.sessions.2xx_count
(count)
The number of responses with 2xx status code (shown as count).
Shown as session
nginx.stream.server_zone.sessions.4xx
(gauge)
The number of responses with 4xx status code.
Shown as session
nginx.stream.server_zone.sessions.4xx_count
(count)
The number of responses with 4xx status code (shown as count).
Shown as session
nginx.stream.server_zone.sessions.5xx
(gauge)
The number of responses with 5xx status code.
Shown as session
nginx.stream.server_zone.sessions.5xx_count
(count)
The number of responses with 5xx status code (shown as count).
Shown as session
nginx.stream.server_zone.sessions.total
(gauge)
The total number of responses sent to clients.
Shown as session
nginx.stream.server_zone.sessions.total_count
(count)
The total number of responses sent to clients (shown as count).
Shown as session
nginx.stream.upstream.peers.active
(gauge)
The current number of connections
Shown as connection
nginx.stream.upstream.peers.backup
(gauge)
A boolean value indicating whether the server is a backup server.
nginx.stream.upstream.peers.connect_time
(gauge)
The average time to connect to this server.
Shown as millisecond
nginx.stream.upstream.peers.connections
(gauge)
The total number of client connections forwarded to this server.
Shown as connection
nginx.stream.upstream.peers.connections_count
(count)
The total number of client connections forwarded to this server (shown as count).
Shown as connection
nginx.stream.upstream.peers.downstart
(gauge)
The time (time since Epoch) when the server became "unavail" or "checking" or "unhealthy"
Shown as millisecond
nginx.stream.upstream.peers.downtime
(gauge)
Total time the server was in the "unavail" or "checking" or "unhealthy" states.
Shown as millisecond
nginx.stream.upstream.peers.downtime_count
(count)
Total time the server was in the "unavail" or "checking" or "unhealthy" states.
Shown as millisecond
nginx.stream.upstream.peers.fails
(gauge)
The total number of unsuccessful attempts to communicate with the server.
Shown as error
nginx.stream.upstream.peers.fails_count
(count)
The total number of unsuccessful attempts to communicate with the server (shown as count).
Shown as error
nginx.stream.upstream.peers.first_byte_time
(gauge)
The average time to receive the first byte of data from this server.
Shown as millisecond
nginx.stream.upstream.peers.health_checks.checks
(gauge)
The total number of health check requests made.
Shown as request
nginx.stream.upstream.peers.health_checks.checks_count
(count)
The total number of health check requests made (shown as count).
Shown as request
nginx.stream.upstream.peers.health_checks.fails
(gauge)
The number of failed health checks.
Shown as error
nginx.stream.upstream.peers.health_checks.fails_count
(count)
The number of failed health checks (shown as count).
Shown as error
nginx.stream.upstream.peers.health_checks.last_passed
(gauge)
Boolean indicating if the last health check request was successful and passed tests.
nginx.stream.upstream.peers.health_checks.unhealthy
(gauge)
How many times the server became unhealthy (state "unhealthy").
nginx.stream.upstream.peers.health_checks.unhealthy_count
(count)
How many times the server became unhealthy (state "unhealthy") (shown as count).
nginx.stream.upstream.peers.id
(gauge)
The ID of the server.
nginx.stream.upstream.peers.max_conns
(gauge)
The max_conns limit for the server.
Shown as connection
nginx.stream.upstream.peers.received
(gauge)
The total number of bytes received from this server.
Shown as byte
nginx.stream.upstream.peers.received_count
(count)
The total number of bytes received from this server (shown as count).
Shown as byte
nginx.stream.upstream.peers.response_time
(gauge)
The average time to receive the last byte of data from this server.
Shown as millisecond
nginx.stream.upstream.peers.response_time_histogram
(gauge)
The average time to receive the last byte of data from this server as a histogram.
Shown as millisecond
nginx.stream.upstream.peers.response_time_histogram.avg
(gauge)

Shown as millisecond
nginx.stream.upstream.peers.response_time_histogram.count
(rate)

Shown as millisecond
nginx.stream.upstream.peers.response_time_histogram.max
(gauge)

Shown as millisecond
nginx.stream.upstream.peers.response_time_histogram.median
(gauge)

Shown as millisecond
nginx.stream.upstream.peers.selected
(gauge)
The time (time since Epoch) when the server was last selected to process a connection.
Shown as millisecond
nginx.stream.upstream.peers.sent
(gauge)
The total number of bytes sent to this server.
Shown as byte
nginx.stream.upstream.peers.sent_count
(count)
The total number of bytes sent to this server (shown as count).
Shown as byte
nginx.stream.upstream.peers.unavail
(gauge)
How many times the server became unavailable for client connections (state "unavail").
nginx.stream.upstream.peers.unavail_count
(count)
How many times the server became unavailable for client connections (state "unavail") (shown as count).
nginx.stream.upstream.peers.weight
(gauge)
Weight of the server.
nginx.stream.upstream.zombies
(gauge)
The current number of servers removed from the group but still processing active client connections.
Shown as host
nginx.stream.zone_sync.status.bytes_in
(gauge)
The number of bytes received by this node.
Shown as byte
nginx.stream.zone_sync.status.bytes_out
(gauge)
The number of bytes sent by this node.
Shown as byte
nginx.stream.zone_sync.status.msgs_in
(gauge)
The number of messages received by this node.
Shown as message
nginx.stream.zone_sync.status.msgs_out
(gauge)
The number of messages sent by this node.
Shown as message
nginx.stream.zone_sync.status.nodes_online
(gauge)
The number of peers this node is connected to.
nginx.stream.zone_sync.zone.records_pending
(gauge)
The number of records that need to be sent to the cluster.
Shown as record
nginx.stream.zone_sync.zone.records_total
(gauge)
The number of records stored in the shared memory zone.
Shown as record
nginx.stream.zone_sync.zone.records_total_count
(count)
The total number of records stored in the shared memory zone.
Shown as record
nginx.timestamp
(gauge)
Current time since Epoch.
Shown as millisecond
nginx.upstream.keepalive
(gauge)
The current number of idle keepalive connections.
Shown as connection
nginx.upstream.peers.active
(gauge)
The current number of active connections.
Shown as connection
nginx.upstream.peers.backup
(gauge)
A boolean value indicating whether the server is a backup server.
nginx.upstream.peers.downstart
(gauge)
The time (since Epoch) when the server became "unavail" or "unhealthy".
Shown as millisecond
nginx.upstream.peers.downtime
(gauge)
Total time the server was in the "unavail" and "unhealthy" states.
Shown as millisecond
nginx.upstream.peers.downtime_count
(count)
Total time the server was in the "unavail" and "unhealthy" states.
Shown as millisecond
nginx.upstream.peers.fails
(gauge)
The total number of unsuccessful attempts to communicate with the server.
nginx.upstream.peers.fails_count
(count)
The total number of unsuccessful attempts to communicate with the server (shown as count).
nginx.upstream.peers.header_time
(gauge)
The total amount of time spent on receiving the response header from the upstream server.
Shown as millisecond
nginx.upstream.peers.health_checks.checks
(gauge)
The total number of health check requests made.
nginx.upstream.peers.health_checks.checks_count
(count)
The total number of health check requests made (shown as count).
nginx.upstream.peers.health_checks.fails
(gauge)
The number of failed health checks.
nginx.upstream.peers.health_checks.fails_count
(count)
The number of failed health checks (shown as count).
nginx.upstream.peers.health_checks.last_passed
(gauge)
Boolean indicating if the last health check request was successful and passed tests.
nginx.upstream.peers.health_checks.unhealthy
(gauge)
How many times the server became unhealthy (state "unhealthy").
nginx.upstream.peers.health_checks.unhealthy_count
(count)
How many times the server became unhealthy (state "unhealthy") (shown as count).
nginx.upstream.peers.id
(gauge)
The ID of the server.
nginx.upstream.peers.max_conns
(gauge)
The max_conns limit for this server.
Shown as connection
nginx.upstream.peers.received
(gauge)
The total amount of data received from this server.
Shown as byte
nginx.upstream.peers.received_count
(count)
The total amount of data received from this server (shown as count).
Shown as byte
nginx.upstream.peers.requests
(gauge)
The total number of client requests forwarded to this server.
Shown as request
nginx.upstream.peers.requests_count
(count)
The total number of client requests forwarded to this server (shown as count).
Shown as request
nginx.upstream.peers.response_time
(gauge)
The average time to receive the last byte of data from this server.
Shown as millisecond
nginx.upstream.peers.response_time_histogram
(gauge)
The average time to receive the last byte of data from this server as a histogram.
Shown as millisecond
nginx.upstream.peers.response_time_histogram.avg
(gauge)

Shown as millisecond
nginx.upstream.peers.response_time_histogram.count
(rate)

Shown as millisecond
nginx.upstream.peers.response_time_histogram.max
(gauge)

Shown as millisecond
nginx.upstream.peers.response_time_histogram.median
(gauge)

Shown as millisecond
nginx.upstream.peers.responses.1xx
(gauge)
The number of responses with 1xx status code from this server.
Shown as response
nginx.upstream.peers.responses.1xx_count
(count)
The number of responses with 1xx status code (shown as count) from this server.
Shown as response
nginx.upstream.peers.responses.2xx
(gauge)
The number of responses with 2xx status code from this server.
Shown as response
nginx.upstream.peers.responses.2xx_count
(count)
The number of responses with 2xx status code (shown as count) from this server.
Shown as response
nginx.upstream.peers.responses.3xx
(gauge)
The number of responses with 3xx status code from this server.
Shown as response
nginx.upstream.peers.responses.3xx_count
(count)
The number of responses with 3xx status code (shown as count) from this server.
Shown as response
nginx.upstream.peers.responses.4xx
(gauge)
The number of responses with 4xx status code from this server.
Shown as response
nginx.upstream.peers.responses.4xx_count
(count)
The number of responses with 4xx status code (shown as count) from this server.
Shown as response
nginx.upstream.peers.responses.5xx
(gauge)
The number of responses with 5xx status code from this server.
Shown as response
nginx.upstream.peers.responses.5xx_count
(count)
The number of responses with 5xx status code (shown as count).
Shown as response
nginx.upstream.peers.responses.code
(count)
The total number of responses from this server per each status code.
Shown as response
nginx.upstream.peers.responses.total
(gauge)
The total number of responses obtained from this server.
Shown as response
nginx.upstream.peers.responses.total_count
(count)
The total number of responses obtained from this server (shown as count).
Shown as response
nginx.upstream.peers.selected
(gauge)
The time (since Epoch) when the server was last selected to process a request (1.7.5).
Shown as millisecond
nginx.upstream.peers.sent
(gauge)
The total amount of data sent to this server.
Shown as byte
nginx.upstream.peers.sent_count
(count)
The total amount of data sent to this server (shown as count).
Shown as byte
nginx.upstream.peers.unavail
(gauge)
How many times the server became unavailable for client requests (state "unavail") due to the number of unsuccessful attempts reaching the max_fails threshold.
nginx.upstream.peers.unavail_count
(count)
How many times the server became unavailable for client requests (state "unavail") due to the number of unsuccessful attempts reaching the max_fails threshold (shown as count).
nginx.upstream.peers.weight
(gauge)
Weight of the server.
nginx.upstream.zombies
(gauge)
The current number of servers removed from the group but still processing active client connections.
Shown as host
nginx.version
(gauge)
Version of nginx.

オープンソース NGINX のユーザーは、ここに示したメトリクスのすべてを利用できるわけではありません。各モジュールで提供されるメトリクスを確認するには、スタブステータス (オープンソース NGINX) と HTTP ステータス (NGINX Plus) のモジュールリファレンスを比較してください。

オープンソース NGINX と NGINX Plus では名前が異なるメトリクスがいくつかありますが、それらは同じメトリクスです。

NGINXNGINX Plus
nginx.net.connectionsnginx.connections.active
nginx.net.conn_opened_per_snginx.connections.accepted
nginx.net.conn_dropped_per_snginx.connections.dropped
nginx.net.request_per_snginx.requests.total

次のメトリクスは、正確には同じメトリクスではありませんが、関連はあります。

NGINXNGINX Plus
nginx.net.waitingnginx.connections.idle

最後に、次のメトリクスには対応するメトリクスがありません。

メトリクス説明
nginx.net.readingnginx がリクエストヘッダーを読み取っている現在の接続数。
nginx.net.writingnginx がクライアントへの応答を書き込んでいる現在の接続数。

イベント

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

サービスチェック

nginx.can_connect
Returns CRITICAL if the Agent is unable to connect to and collect metrics from the monitored Nginx instance. Returns OK otherwise.
Statuses: ok, critical

トラブルシューティング

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

その他の参考資料

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