Supported OS Linux Windows Mac OS

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

PHP 概要

概要

PHP-FPM チェックは、FPM プールの状態を監視し、リクエストパフォーマンスを追跡します。

計画と使用

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

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

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

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

メトリクスベース SLO

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

  1. Agent のコンフィギュレーションディレクトリのルートにある conf.d/ フォルダーの php_fpm.d/conf.yaml ファイルを編集します。使用可能なすべてのコンフィギュレーションオプションの詳細については、php_fpm.d/conf.yaml のサンプルを参照してください。

    init_config:
    
    instances:
      ## @param status_url - string - required
      ## Get metrics from your FPM pool with this URL
      ## The status URLs should follow the options from your FPM pool
      ## See http://php.net/manual/en/install.fpm.configuration.php
      ##   * pm.status_path
      ## You should configure your fastcgi passthru (nginx/apache) to catch these URLs and
      ## redirect them through the FPM pool target you want to monitor (FPM `listen`
      ## directive in the config, usually a UNIX socket or TCP socket.
      #
      - status_url: http://localhost/status
    
        ## @param ping_url - string - required
        ## Get a reliable service check of your FPM pool with `ping_url` parameter
        ## The ping URLs should follow the options from your FPM pool
        ## See http://php.net/manual/en/install.fpm.configuration.php
        ##   * ping.path
        ## You should configure your fastcgi passthru (nginx/apache) to
        ## catch these URLs and redirect them through the FPM pool target
        ## you want to monitor (FPM `listen` directive in the config, usually
        ## a UNIX socket or TCP socket.
        #
        ping_url: http://localhost/ping
    
        ## @param use_fastcgi - boolean - required - default: false
        ## Communicate directly with PHP-FPM using FastCGI
        #
        use_fastcgi: false
    
        ## @param ping_reply - string - required
        ## Set the expected reply to the ping.
        #
        ping_reply: pong
    
  2. Agent を再起動します

コンテナ化

コンテナ環境の場合は、オートディスカバリーのインテグレーションテンプレートのガイドを参照して、次のパラメーターを適用してください。

パラメーター
<INTEGRATION_NAME>php_fpm
<INIT_CONFIG>空白または {}
<INSTANCE_CONFIG>{"status_url":"http://%%host%%/status", "ping_url":"http://%%host%%/ping", "use_fastcgi": false, "ping_reply": "pong"}

追加情報

複数のプール

Kubernetes で実行されている場合は、同じプロキシサーバー、共通のシナリオを使用して複数の PHP-FPM プールを監視することができます。それには、別の PHP-FPM インスタンスを指すようにサーバーのルートを変更します。以下に NGINX コンフィギュレーションの例を示します。

server {
    ...

    location ~ ^/(status1|ping1)$ {
        access_log off;
        fastcgi_pass instance1_ip:instance1_port;
        include fastcgi_params;
        fastcgi_param スクリプトのファイル名 $document_root$fastcgi_script_name;
    }

    location ~ ^/(status2|ping2)$ {
        access_log off;
        fastcgi_pass instance2_ip:instance2_port;
        include fastcgi_params;
        fastcgi_param スクリプトのファイル名 $document_root$fastcgi_script_name;
    }
}

規模が大きいためにこの方法で手間がかかりすぎる場合は、use_fastcgitrue に設定して、チェックがプロキシサーバーをバイパスし、FastCGI を使用して直接 PHP-FPM と通信するようにします。status_url または ping_url からポート番号が省略された場合、デフォルトのポートは 9000 です。

Unix ソケット

PHP-FPM インストールが Unix ソケットを使用する場合、status_urlping_url に対して以下の構文を使用して、use_fastcgi を有効にする必要があります。

パラメーター
status_urlunix:///<ファイル_パス>.sock/status
ping_urlunix:///<ファイル_パス>.sock/ping
ping_replypong
use_fastcgitrue

: オートディスカバリーを使用する場合、個別のコンテナ/タスク/ポッドで稼働する Agent は、FPM プールの Unix ソケットファイルにアクセスできません。アクセスするためには、Agent をサイドカーとして実行する必要があります。

検証

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

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

データセキュリティ

php_fpm.listen_queue.size
(gauge)
Size of the socket queue of pending connections
php_fpm.processes.active
(gauge)
Total number of active processes
Shown as process
php_fpm.processes.idle
(gauge)
Total number of idle processes
Shown as process
php_fpm.processes.max_active
(count)
The maximum number of processes that can run at once
Shown as process
php_fpm.processes.max_reached
(count)
The number of times the process limit has been reached (when pm tries to start more children)
Shown as process
php_fpm.processes.total
(gauge)
Total number of processes
Shown as process
php_fpm.requests.accepted
(count)
Total number of accepted requests
Shown as request
php_fpm.requests.slow
(count)
Total number of slow requests
Shown as request

ヘルプ

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

ヘルプ

php_fpm.can_ping
Returns CRITICAL if the Agent is unable to get a pong from the PHP-FPM ping URL.
Statuses: ok, critical

ヘルプ

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