PHP FPM

本章节为 Cloud Insight 支持的平台服务的文档的示例。

目前能够想到的章节分为以下几个部分:

  • 支持的性能指标
  • 如何配置 PHP-FPM 监控
  • 常见的问题

性能指标

Cloud Insight 采集 PHP FPM 以下性能指标:

  • listen_queue.size
  • processes.active
  • processes.active
  • processes.max_reached
  • processes.total
  • requests.accepted
  • requests.slow

配置 PHP FPM 监控

开启 PHP-FPM 状态页监控

确保 PHP-FPM 状态页处于开启状态。详细说明见:PHP-FPM 官方文档

pm.status_path = /status

编辑配置文件

编辑配置文件 conf.d/php_fpm.yaml,使 Cloud Insight Agent 可以与 FPM 终端通信,有关终端信息请查看线程池配置。

init_config:

instances:
  - # Get metrics from your FPM pool with this URL
    status_url: http://localhost/status
    # Get a reliable service check of you FPM pool with that one
    ping_url: http://localhost/ping
    # These 2 URLs should follow the options from your FPM pool
    # See http://php.net/manual/en/install.fpm.configuration.php
    #   * pm.status_path
    #   * 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.
    #
    # Use this if you have basic authentication on these pages
    # user: cloudinsight
    # password: ONEAPM
    #
    # Array of custom tags
    # By default metrics and service check will be tagged by pool and host
    # tags:
    #   - tag_key:tag_value

重启 Agent

重启 OneAPM Cloud Insight Agent,使配置生效。

您也可以通过查看 Agent Info 信息,来验证配置是否成功。当出现以下信息,则代表安装成功。

Checks
======

[...]

php_fpm
------
  - instance #0 [OK]
  - Collected 8 metrics & 0 events

有关 Agent Info 信息的查看,请访问帮助中心,查看 Cloud Insight Agent 常用操作

常见问题