X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectd.conf.pod;h=417af0d7082e09147de1777ec90e803a19b6fee5;hb=5131a49ad0584aa22282aacf72b6e4ca75356bae;hp=9d098f1264fb8114d1efa418e9e6318626a50748;hpb=d6d42818a8794a756727a6bb56e3680c7eefd6f9;p=collectd.git diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 9d098f12..417af0d7 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3627,6 +3627,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. @@ -3656,6 +3663,11 @@ L. + + Statement "SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);" + StoreRates true + + Host "hostname" Port "5432" @@ -3672,6 +3684,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 @@ -3855,6 +3873,84 @@ non-by_table queries above. =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 @@ -3870,6 +3966,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 @@ -3942,11 +4049,36 @@ B for details. =item B I -Specify a I which should be executed for the database connection. This -may be any of the predefined or user-defined queries. If no such option is -given, it defaults to "backends", "transactions", "queries", "query_plans", -"table_states", "disk_io" and "disk_usage". Else, the specified queries are -used only. +Specifies a I which should be executed in the context of the database +connection. This may be any of the predefined or user-defined queries. If no +such option is given, it defaults to "backends", "transactions", "queries", +"query_plans", "table_states", "disk_io" and "disk_usage" (unless a B +has been specified). Else, the specified queries are used only. + +=item B I + +Assigns the specified I backend to the database connection. This +causes all collected data to be send to the database using the settings +defined in the writer configuration (see the section "FILTER CONFIGURATION" +below for details on how to selectively send data to certain plugins). + +Each writer will register a flush callback which may be used when having long +transactions enabled (see the B option above). When issuing +the B command (see L for details) the current +transaction will be committed right away. Two different kinds of flush +callbacks are available with the C plugin: + +=over 4 + +=item B + +Flush all writer backends. + +=item BI + +Flush all writers of the specified I only. + +=back =back