Home

Awesome

phpfpm_exporter

Prometheus exporter for php-fpm status information. If you are running php-fpm with nginx webserver (or any other webserver), and have configured your php-fpm to serve status information, phpfpm_exporter will export the status information into a format that prometheus can read.

Installation

You will need to have Go http://golang.org.

Checkout the source:

git clone https://github.com/craigmj/phpfpm_exporter

Build the code:

cd phpfpm_exporter
./build.sh

Now you've got the binary in bin/phpfpm_exporter

Running

Because this is a Go application, you only need the binary. So you can copy that to your server, which needs to be configured to report php-fpm status information.

Start the exporter with

phpfpm_exporter

Running from Docker

This service is provided as a docker image that can be run with the command

docker run --rm softonic/phpfpm_exporter \
  -status.url=http://nginx/status?json \
  -listen.address 0.0.0.0:9099

Just change the example parameters to fit your use case.

Command Line Options

The exporter accepts 3 command line options

Configuring Prometheus

Assuming you're running prometheus on the same server as your phpfpm_exporter, you need to add to your scrape_configs in prometheus.yml:

scrape_configs:
  - job_name: 'fpm'
    static_configs:
      - targets: ['127.0.0.1:9099']

Obviously the targets value should match the listen.address command line option you've set for phpfpm_exporter.

Metrics

The phpfpm_exporter exports the following metrics to prometheus:

phpfpm_acceptedconnections_count

The number of connections accepted by the pool.

Time Series labels

phpfpm_listenqueue_size

The size of the listen queue for each pool.

Time Series labels

phpfpm_processes_count

The number of processes in each pool.

Time Series labels

Note that we don't reflect the total processes as reported by php-fpm, since that is simply idle+active and can thus be calculated.

phpfpm_maxchildren_count

The maximum number of child processes reached in the pool.

Time Series labels