From 9ebbb794012e4f68118b550377a42f7b1dbf4bb5 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 23 Jul 2008 14:31:08 +0200 Subject: [PATCH] collectd.conf(5): Documented the support for custom queries. Also, collectd.conf.in has been updated. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- src/collectd.conf.in | 9 ++++ src/collectd.conf.pod | 105 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 108 insertions(+), 6 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 107112d3..b54f3518 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -256,6 +256,13 @@ FQDNLookup true # # +# +# Query "SELECT magic, spells FROM wizard WHERE host = $1;" +# Param hostname +# Column gauge magic +# Column counter spells +# +# # # Host "hostname" # Port 5432 @@ -264,6 +271,8 @@ FQDNLookup true # # SSLMode "prefer" # KRBSrvName "kerberos_service_name" +# +# Query magic # # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 1a52ae5c..58ffc783 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -996,16 +996,31 @@ Sets the Time-To-Live of generated ICMP packets. The C plugin queries statistics from PostgreSQL databases. It keeps a persistent connection to all configured databases and tries to -reconnect if the connection has been interrupted. The statistics are collected -from PostgreSQL's B which thus has to be enabled for -this plugin to work correctly. This should usually be the case by default. -See the section "The Statistics Collector" of the B -for details. +reconnect if the connection has been interrupted. A database is configured by +specifying a B block as described below. The default statistics are +collected from PostgreSQL's B which thus has to be +enabled for this plugin to work correctly. This should usually be the case by +default. See the section "The Statistics Collector" of the B for details. + +By specifying custom database queries using a B block as described +below, you may collect any data that is available from some PostgreSQL +database. This way, you are able to access statistics of external daemons +which are available in a PostgreSQL database or use future or special +statistics provided by PostgreSQL without the need to upgrade your collectd +installation. The B manual can be found at L. + + Query "SELECT magic, spells FROM wizard WHERE host = $1;" + Param hostname + Column gauge magic + Column counter spells + + Host "hostname" Port "5432" @@ -1013,15 +1028,84 @@ L. Password "secret" SSLMode "prefer" KRBSrvName "kerberos_service_name" + Query magic Service "service_name" +The B block defines one database query which may later be used by a +database definition. It accepts a single mandatory argument which specifies +the name of the query. The names of all queries have to be unique. The +following configuration options are available to define the query: + +=over 4 + +=item B I + +Specify the I which the plugin should execute. The string may +contain the tokens B<$1>, B<$2>, etc. which are used to reference the first, +second, etc. parameter. The value of the parameters is specified by the +B configuration option - see below for details. To include a literal +B<$> character followed by a number, surround it with single quotes (B<'>). + +Any SQL command which may return data (such as C