Documentation forAppOptics

PHP-FPM

Overview

This integration collects standard query metrics from PHP-FPM. PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation. This integration will retrieve phpfpm stats using either HTTP status page or fpm socket.

This integration is only available for Linux platforms.

Setup

The php-fpm monitoring is accomplished by bridge plugin which is included with the SolarWinds Snap Agent by default. Follow the directions below to enable it for an agent instance. The bridge plugin utilize Telegraf PHP-FPM plugin.

Prerequisites

You'll need to have an Apache server with PHP-FPM accessible. Take note of the host address, port, and password (if set). This will be needed later in the configuration step.

Configuration

The agent provides an example task file to help you get started quickly, but requires you to provide the correct settings for your PHP-FPM installation. To enable the task:

  1. Make a copy of the PHP-FPM example task file /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-phpfpm.yaml.example, renaming it to /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-phpfpm.yaml:

    sudo cp -p /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-phpfpm.yaml.example /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-phpfpm.yaml
  2. Edit the task file with settings specific to your PHP-FPM install:

    In this configuration you'll notice that it is already configured to listen on localhost by using the setting urls: "http://localhost/status". Update this line to specify the server address to listen on.

    ---
    version: 2
    
    schedule:
      type: cron
      interval: "0 * * * * *"
      
    plugins:
      - plugin_name: bridge
      
        config:
          phpfpm:
          
            ## An array of addresses to gather stats about. Specify an ip or hostname
            ## with optional port and path
            ##
            ## Plugin can be configured in three modes (either can be used):
            ##   - http: the URL must start with http:// or https://, ie:
            ##       "http://localhost/status"
            ##       "http://192.168.130.1/status?full"
            ##
            ##   - unixsocket: path to fpm socket, ie:
            ##       "/var/run/php5-fpm.sock"
            ##      or using a custom fpm status path:
            ##       "/var/run/php5-fpm.sock:fpm-custom-status-path"
            ##
            ##   - fcgi: the URL must start with fcgi:// or cgi://, and port must be present, ie:
            ##       "fcgi://10.0.0.12:9000/status"
            ##       "cgi://10.0.10.12:9001/status"
            ##
            urls:
              - "http://localhost/status"
              
            ## Optional TLS Config
            # tls_ca: /path/to/cafile
            # tls_cert: /path/to/certfile
            # tls_key: /path/to/keyfile
            
            ## Use TLS but skip chain & host verification
            # insecure_skip_verify: true
            
        publish:
          - plugin_name: publisher-appoptics
  3. Restart the agent:

    sudo service swisnapd restart
  4. Enable the PHP-FPM integration in AppOptics

    On the Integrations Page you will see PHP-FPM integration available if the previous steps were successful. It may take a couple minutes before the PHP-FPM integration is identified. Select the PHP-FPM integration to open the configuration menu in the UI, and enable it. If you do not see it, see Troubleshooting Linux.

Testing Integration

To check if and what metrics can be collected with given configuration, run bridge plugin in debug mode:

/opt/SolarWinds/Snap/bin/snap-plugin-collector-bridge --debug-mode --plugin-config "{\"phpfpm\": {\"urls\": [\"http://localhost/status\"]}}"

Metrics and Tags

Metrics

The table below outlines the default set of metrics collected by the php-fpm integration.

Namespace Description
phpfpm.accepted_conn The number of request accepted by the pool
phpfpm.listen_queue The number of request in the queue of pending connections. If this number is non-zero then you should increase the number of process FPM can spawn
phpfpm.max_listen_queue The maximum number of requests in the queue of pending connections since FPM has started
phpfpm.listen_queue_len The size of the socket queue of pending connections
phpfpm.idle_processes The number of idle processes
phpfpm.active_processes The number of active processes
phpfpm.total_processes The number of idle + active processes
phpfpm.max_active_processes The maximum number of active processes since FPM has started
phpfpm.max_children_reached The number of times the process limit has been reached (when pm tries to start more children). If that value is not zero then you may need to increase max process limit for your PHP-FPM pool.
phpfpm.slow_requests The number of slow requests. Enable php-fpm slow-log before you consider this. If this value is non-zero you may have slow php processes. Poorly written mysql queries are generally culprit.

Tags

The table below outlines the default set of tags provided for each metric.

Tags Description
hostname Name of the host. Instead of using this tag we recommend using the @host alias.
server Name of the server
port Port which the server is running on

Navigation Notice: When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with other integrated experience products. How you navigate AppOptics and access its features may vary from these instructions.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.