Docs » Integrations Guide » Use the Smart Agent » Monitors » collectd/php-fpm

collectd/php-fpm 🔗

Monitor Type: collectd/php-fpm (Source)

Accepts Endpoints: Yes

Multiple Instances Allowed: Yes

Overview 🔗

Monitors PHP-FPM using pool status URL.

PHP-FPM Setup 🔗

To configure the PHP-FPM service itself to expose status metrics:

  1. Enable status https://www.php.net/manual/en/install.fpm.configuration.php#pm.status-path

  2. Then, configure access through the webserver, i.e. nginx:

     location ~ ^/(status|ping)$ {
       access_log off;
       fastcgi_pass unix:/run/php/php-fpm.sock;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     }
    
  3. Restart Webserver (i.e. Nginx) and PHP-FPM.

Note: Make sure that the URL you provide to reach fpm status page through your webserver ends in ?json. This returns the metrics as json, which this plugin requires.

Config Examples 🔗

monitors:
 - type: collectd/php-fpm
   host: localhost
   port: 80

If fpm status page is exposed on an endpoint other than /status, you can use the path config option:

monitors:
 - type: collectd/php-fpm
   host: localhost
   port: 80
   path: "/status"

You can also define the entire URL yourself using url config option but keep in mind useHTTPS will be ignored if so:

monitors:
 - type: collectd/php-fpm
   host: localhost
   port: 80
   useHTTPS: true # will be ignored
   url: "http://{{.host}}:{{.port}}/fpm-status?json"

For a full list of options, see Configuration.

Configuration 🔗

To activate this monitor in the Smart Agent, add the following to your agent config:

monitors:  # All monitor config goes under this key
 - type: collectd/php-fpm
   ...  # Additional config

For a list of monitor options that are common to all monitors, see Common Configuration.

Config option Required Type Description
host no string The hostname of the webserver (i.e. 127.0.0.1)
port no integer The port number of the webserver (i.e. 80) (default: 0)
useHTTPS no bool If true, the monitor will connect to Supervisor via HTTPS instead of HTTP. (default: false)
path no string The URL path to use for the scrape URL for Supervisor. (default: /status)
url no string The URL, either a final URL or a Go template that will be populated with the host, port and path values.
name no string This will be sent as the plugin_instance dimension and can be any name you like.

Metrics 🔗

These are the metrics available for this monitor. Metrics that are categorized as container/host (default) are in bold and italics in the list below.

  • phpfpm_processes.active (gauge)
    Total number of active processes.
  • phpfpm_processes.idle (gauge)
    Total number of idle processes.
  • phpfpm_processes.max_reached (counter)
    The number of times the process limit has been reached.
  • phpfpm_requests.accepted (counter)
    Total number of accepted requests.
  • phpfpm_requests.slow (counter)
    Total number of slow requests.

Non-default metrics (version 4.7.0+) 🔗

To emit metrics that are not default, you can add those metrics in the generic monitor-level extraMetrics config option. Metrics that are derived from specific configuration options that do not appear in the above list of metrics do not need to be added to extraMetrics.

To see a list of metrics that will be emitted you can run agent-status monitors after configuring this monitor in a running agent instance.

Dimensions 🔗

The following dimensions may occur on metrics emitted by this monitor. Some dimensions may be specific to certain metrics.

Name Description
plugin_instance Set to whatever you set in the name config option.