Difference between revisions of "Plugin:cURL-JSON/phpfpm"

From collectd Wiki
Jump to: navigation, search
(reworked example)
(Types)
Line 37: Line 37:
 
You'll need to create a custom [[types.db]] and add these [[type]]s:
 
You'll need to create a custom [[types.db]] and add these [[type]]s:
 
  # types.db
 
  # types.db
  http_requests      count:COUNTER:0:134217728
+
  phpfpm_listen_queue  value:GAUGE:0:65535
  listen_queue      value:GAUGE:0:65535
+
  phpfpm_processes    value:GAUGE:0:65535
  active_processes  value:GAUGE:0:65535
+
  phpfpm_requests      value:DERIVE:0:U
  total_processes    value:GAUGE:0:65535
+
  phpfpm_slow_requests value:DERIVE:0:U
  
Type `http_requests' usually already present in the default types, however. See `TypesDB' configuration option in collectd config file for locations of default and custom `types.db' files.
+
See `TypesDB' configuration option in collectd config file for locations of default and custom `types.db' files.
  
 
== TODO ==
 
== TODO ==
 
* Add chart examples.
 
* Add chart examples.

Revision as of 18:24, 25 February 2016

This page contains some example configurations for the cURL-JSON plugin. This page is meant as a cookbook, so if you have a configuration for an aspect not handled here or a daemon not present, please feel free to add anything that's useful for you.

You can use cURL-JSON plugin plugin to collect stats from php-fpm instances. The example of config is below.

Config

LoadPlugin curl_json
<Plugin curl_json>
<URL "http://127.0.0.1/_fpmstatus?json">
 Instance 'main'
 <Key "accepted conn">
     Type "phpfpm_requests"
     Instance ""
 </Key>
 <Key "slow requests">
     Type "phpfpm_slow_requests"
     Instance ""
 </Key>
 <Key "listen queue">
     Type "phpfpm_listen_queue"
     Instance ""
 </Key>
 <Key "active processes">
     Type "phpfpm_processes"
     Instance "active"
 </Key>
 <Key "total processes">
     Type "phpfpm_processes"
     Instance "total"
 </Key>
</URL>
</Plugin>

Please note that the metod used to access php-fpm stats is not FastCGI but HTTP. So you need to configure your web-server to pass such requests to php-fpm instance.

Types

You'll need to create a custom types.db and add these types:

# types.db
phpfpm_listen_queue  value:GAUGE:0:65535
phpfpm_processes     value:GAUGE:0:65535
phpfpm_requests      value:DERIVE:0:U
phpfpm_slow_requests value:DERIVE:0:U

See `TypesDB' configuration option in collectd config file for locations of default and custom `types.db' files.

TODO

  • Add chart examples.