Skip to content

pinba plugin

Plugin name pinba
Type read
Callbacks config, init, read, shutdown
Status supported
Since 4.10
Copyright 2007–2009 Antony Dovgal, 2010 Phoenix Kayo, 2010 Florian octo Forster
License GPLv2
Configuration collectd.conf(5)

Description

The Pinba plugin receives and dispatches timing values from Pinba, a profiling extension for PHP.

The Pinba extension is an extension for the PHP interpreter which collects runtime information about PHP scripts and sends a single UDP packet at the end of execution to a configured address. The Pinba plugin listens for such UDP packets, parses them and aggregates the statistics. Once per interval, the daemon queries those statistics and dispatches them to the write plugins.

Currently, the plugin provides the following information:

  • Requests (executions) per second
  • Average running time
  • Amount printed (bytes per second)
  • User and system resource usage
  • Peak memory usage

Timing information in form of custom tags is currently not supported.

In order to get meaningful and interesting statistics, it is possible to group the statistics by the webserver's hostname (via gethostname(2)), the virtual server's name and the script's name. Grouping is done by views. It is possible to account for an UDP packet twice, for example in a per-host and a per-vhost statistic.

Synopsis

 <Plugin pinba>
   Address "::0"
   Port "30002"
   # Per-vhost statistic
   <View "www.example.com-search">
     Server "www.example.com"
     Script "/search.php"
   </View>
   # Per-webserver statistics
   <View "www-a.example.com-search">
     Host "www-a"
     Server "www.example.com"
     Script "/search.php"
   </View>
   <View "www-b.example.com-search">
     Host "www-b"
     Server "www.example.com"
     Script "/search.php"
   </View>
 </Plugin>

The above example assumes that you have website www.example.com which is served by two webservers, www-a and www-b using some form of load-balancing. The first view will gather statistics for the search script on both webservers, showing what the user experiences. The second and third view collect the same information, but only for one webserver each. This information may be interesting for an administrator, for example to judge whether load-balancing is working correctly.

Example graph

None yet. Add one now!

Dependencies

See also

Configuration

Configuration options · from collectd.conf(5)

See this section in the full configuration reference

The Pinba plugin receives profiling information from Pinba, an extension for the PHP interpreter. At the end of executing a script, i.e. after a PHP-based webpage has been delivered, the extension will send a UDP packet containing timing information, peak memory usage and so on. The plugin will wait for such packets, parse them and account the provided information, which is then dispatched to the daemon once per interval.

Synopsis:

<Plugin pinba>
  Address "::0"
  Port "30002"
  # Overall statistics for the website.
  <View "www-total">
    Server "www.example.com"
  </View>
  # Statistics for www-a only
  <View "www-a">
    Host "www-a.example.com"
    Server "www.example.com"
  </View>
  # Statistics for www-b only
  <View "www-b">
    Host "www-b.example.com"
    Server "www.example.com"
  </View>
</Plugin>

The plugin provides the following configuration options:

Address Node
Configures the address used to open a listening socket. By default, plugin will bind to the any address ::0.
Port Service
Configures the port (service) to bind to. By default the default Pinba port "30002" will be used. The option accepts service names in addition to port numbers and thus requires a string argument.
<View Name> block

The packets sent by the Pinba extension include the hostname of the server, the server name (the name of the virtual host) and the script that was executed. Using View blocks it is possible to separate the data into multiple groups to get more meaningful statistics. Each packet is added to all matching groups, so that a packet may be accounted for more than once.

Host Host
Matches the hostname of the system the webserver / script is running on. This will contain the result of the gethostname(2) system call. If not configured, all hostnames will be accepted.
Server Server
Matches the name of the virtual host, i.e. the contents of the $_SERVER["SERVER_NAME"] variable when within PHP. If not configured, all server names will be accepted.
Script Script
Matches the name of the script name, i.e. the contents of the $_SERVER["SCRIPT_NAME"] variable when within PHP. If not configured, all script names will be accepted.