Monitoring php5-fpm/lighttpd with collectd

php5-fpm offers a status page, which must be called throught the webserver.

fpm pool configuration

Here are the important lines:

[zarafa]
listen = /var/run/php5-fpm-zarafa.sock
pm.status_path = /.status-zarafa.fpm
...

lighttpd configuration

You must configure lighttpd to pass requests to php5-fpm. Put the following lines into /etc/lighttpd/conf-enabled/99-local.conf:

$HTTP["host"] == "127.0.0.1" {
        fastcgi.server = ( ".status-zarafa.fpm" =>
                ((
                        "socket" => "/var/run/php5-fpm-zarafa.sock",
                        "check-local" => "disable",
                        "broken-scriptfilename" => "enable"
                ))
        )
}

collectd configuration

Set the following into collectd.conf:

LoadPlugin curl_json

<Plugin curl_json>
<URL "http://127.0.0.1/.status-zarafa.fpm?json">
  Instance "fpm-zarafa"
  <Key "accepted conn">
      Type "http_requests"
  </Key>
  <Key "listen queue len">
      Type "listen_queue"
  </Key>
  <Key "active processes">
      Type "total_processes"
  </Key>
  <Key "total processes">
      Type "total_processes"
  </Key>
</URL>

try it manually

curl http://127.0.0.1/.status-zarafa.fpm
pool:                 zarafa
process manager:      dynamic
start time:           28/Jun/2016:20:10:03 +0200
start since:          1255
accepted conn:        67
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       2
active processes:     1
total processes:      3
max active processes: 1
max children reached: 0
slow requests:        0

Previous Post Next Post