The PostgreSQL plugin connects to and executes SQL statements on a PostgreSQL database. It then reads back the results and, depending on the configuration, the returned values are then converted into collectd "value lists" (the data structure used internally to pass statistics around). It is a very generic plugin, so reading the collectd.conf(5) manpage is a must.
The configuration syntax of the PostgreSQL, DBI, and Oracle plugins is very similar, because the configuration of those plugins is handled by the same module. Also, we tried to keep the syntax similar to that of the SNMP plugin. So if you use any of those plugins already, most of the following will look familiar.
<Plugin postgresql> <Query magic> Statement "SELECT magic FROM wizard WHERE host = $1;" Param hostname <Result> Type gauge InstancePrefix "magic" ValuesFrom magic </Result> </Query> <Query rt36_tickets> Statement "SELECT COUNT(type) AS count, type \ FROM (SELECT CASE \ WHEN resolved = 'epoch' THEN 'open' \ ELSE 'resolved' END AS type \ FROM tickets) type \ GROUP BY type;" <Result> Type counter InstancePrefix "rt36_tickets" InstancesFrom "type" ValuesFrom "count" </Result> </Query> <Database foo> Host "hostname" Port "5432" User "username" Password "secret" SSLMode "prefer" KRBSrvName "kerberos_service_name" Query magic </Database> <Database bar> Service "service_name" Query backend # predefined Query rt36_tickets </Database> </Plugin>
None yet. Add one now!
(The PostgreSQL C client library.)