X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcollectd.conf.pod;h=29a1d1457ca3367587fb80293ec92c06dac54101;hb=4a9d11514a7e95d89dafc3f7f5f4610e707ae9e3;hp=66ead9c57e83ddc5fdf784b3c5d8468c1dda290c;hpb=fb064ef2ce197070a2735cf95d7c08d5f3d074a7;p=collectd.git diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 66ead9c5..29a1d145 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3450,6 +3450,13 @@ which are available in a PostgreSQL database or use future or special statistics provided by PostgreSQL without the need to upgrade your collectd installation. +Starting with version 5.2, the C plugin supports writing data to +PostgreSQL databases as well. This has been implemented in a generic way. You +need to specify an SQL statement which will then be executed by collectd in +order to write the data (see below for details). The benefit of that approach +is that there is no fixed database layout. Rather, the layout may be optimized +for the current setup. + The B manual can be found at L. @@ -3479,6 +3486,11 @@ L. + + Statement "SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);" + StoreRates true + + Host "hostname" Port "5432" @@ -3495,6 +3507,12 @@ L. Query backend # predefined Query rt36_tickets + + + # ... + Writer sqlstore + CommitInterval 10 + The B block defines one database query which may later be used by a @@ -3656,6 +3674,84 @@ This query collects the on-disk size of the database in bytes. =back +The B block defines a PostgreSQL writer backend. It accepts a single +mandatory argument specifying the name of the writer. This will then be used +in the B specification in order to activate the writer instance. The +names of all writers have to be unique. The following options may be +specified: + +=over 4 + +=item B I + +This mandatory option specifies the SQL statement that will be executed for +each submitted value. A single SQL statement is allowed only. Anything after +the first semicolon will be ignored. + +Nine parameters will be passed to the statement and should be specified as +tokens B<$1>, B<$2>, through B<$9> in the statement string. The following +values are made available through those parameters: + +=over 4 + +=item B<$1> + +The timestamp of the queried value as a floating point number. + +=item B<$2> + +The hostname of the queried value. + +=item B<$3> + +The plugin name of the queried value. + +=item B<$4> + +The plugin instance of the queried value. This value may be B if there +is no plugin instance. + +=item B<$5> + +The type of the queried value (cf. L). + +=item B<$6> + +The type instance of the queried value. This value may be B if there is +no type instance. + +=item B<$7> + +An array of names for the submitted values (i.Ee., the name of the data +sources of the submitted value-list). + +=item B<$8> + +An array of types for the submitted values (i.Ee., the type of the data +sources of the submitted value-list; C, C, ...). Note, that if +B is enabled (which is the default, see below), all types will be +C. + +=item B<$9> + +An array of the submitted values. The dimensions of the value name and value +arrays match. + +=back + +In general, it is advisable to create and call a custom function in the +PostgreSQL database for this purpose. Any procedural language supported by +PostgreSQL will do (see chapter "Server Programming" in the PostgreSQL manual +for details). + +=item B B|B + +If set to B (the default), convert counter values to rates. If set to +B counter values are stored as is, i.Ee. as an increasing integer +number. + +=back + The B block defines one PostgreSQL database for which to collect statistics. It accepts a single mandatory argument which specifies the database name. None of the other options are required. PostgreSQL will use @@ -3671,6 +3767,17 @@ for details. Specify the interval with which the database should be queried. The default is to use the global B setting. +=item B I + +This option may be used for database connections which have "writers" assigned +(see above). If specified, it causes a writer to put several updates into a +single transaction. This transaction will last for the specified amount of +time. By default, each update will be executed in a separate transaction. Each +transaction generates a fair amount of overhead which can, thus, be reduced by +activating this option. The draw-back is, that data covering the specified +amount of time will be lost, for example, if a single statement within the +transaction fails or if the database server crashes. + =item B I Specify the hostname or IP of the PostgreSQL server to connect to. If the