FPM (FastCGI Process Manager) is an alternative to PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites. php - FPM is one of the most popular open source programming languages on the internet used for web development in platforms such as Magento, WordPress or Drupal.

Prerequisites

  1. Edit the file /etc/nginx/sites-available/default and uncomment the php command lines and place the appropriate socket path to php-fpm socket file as follows:
    location ~ \.php$ 
    {
    include snippets/fastcgi-php.conf;
    #
    # # With php-fpm (or other unix sockets):
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    # # With php-cgi (or other tcp sockets):
    # fastcgi_pass 127.0.0.1:9000;
    }
    
  2. Add the server status in default nginx file:
    location ~ ^/(status|ping)$ 
    {
        allow 127.0.0.1;
        include fastcgi_params;
        fastcgi_pass   unix:/var/run/php7.2-fpm.sock;
    }
    
  3. For Virtual machines, install the Linux agent.

Configuring the credentials

Configure the credentials in the directory /opt/opsramp/agent/conf/app.d/creds.yaml

phpfpm:
- name: phpfpm
  user: <username>
  pwd: <Password>
  encoding-type: plain
  labels:
    key1: val1
    key2: val2
  

Configuring the application

Virtual machine

Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-detection.yaml

- name: php-fpm
  instance-checks:
    service-check:
      - php-fpm
    process-check:
      - php-fpm
    port-check:
      - 80
  

Docker environment

Configure the application in the directory /opt/opsramp/agent/conf/app/discovery/auto-container-detection.yaml

- name: php-fpm
  container-checks:
    image-check:
      - nginx
    port-check:
      - 80
  

Kubernetes environment

Configure the application in config.yaml

- name: php-fpm
  container-checks:
    image-check:
      - nginx
    port-check:
      - 80
  

Validate

Go to Resources under the Infrastructure tab to check if your resources are onboarded and the metrics are collected.

Supported metrics

OpsRamp MetricMetric Display NameUnit
php_fpm_accepted_conn

Total number of accepted connections
Accepted Conn
php_fpm_listen_queue

Size of the socket queue of pending connections
Listen Queue
php_fpm_max_listen_queue

Maximum size of listen queue
Max Listen Queue
php_fpm_listen_queue_len

Total number of idle processes
Listen Queue Len
php_fpm_active_processes

Total number of active processes
Active Processes
php_fpm_total_processes

Total number of processes
Total Processes
php_fpm_max_active_processes

Number of times the process limit is reached
Max Active Processes
php_fpm_slow_requests

Total number of slow requests
Slow Requests