author | Sebastian Harl <sh@tokkee.org> | |
Sat, 18 Aug 2012 15:23:42 +0000 (17:23 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 18 Aug 2012 15:23:42 +0000 (17:23 +0200) | ||
commit | 893f2b75eb8c0cedc1e665b69f9ccc1b7e82a874 | |
tree | a0551f7182cbbdb9671725b6fc19bf7a083c8ed0 | tree | snapshot |
parent | 20ef953018ec15376b5d5a243b0214e8babb06d0 | commit | diff |
postgresql plugin: Added generic support for writing values to a database.
This has been implemented by requiring the user to specify an SQL statement to
be used for storing a value-list in PostgreSQL. Usually, this should be done
by creating custom functions to take care of that.
The user specified statement will then be called by collectd with eight
arguments: time, host, plugin, plugin instance (or NULL), type, type instance
(or NULL), array of value names (data source names) and an array of the
values.
Two elements have been added to the config parser: A <Writer> block may be
used to name an SQL statement (specified using the 'Statement' option) to be
used for writing data. In a <Database> block, the new option 'Writer' may be
used to apply a writer to a database connection.
The current approach has two benefits: for one, a user may chose whatever
database layout best suits her needs. Also, it is very easy to experiment with
different approaches on how to structure the data in a database without the
need to modify the plugin. This can be done in SQL, which (hopefully) is the
language that people working with PostgreSQL databases like most ;-)
If it happens to turn out that some approach is rather superior, it may still
be re-implemented in a specific plugin in later versions.
This has been implemented by requiring the user to specify an SQL statement to
be used for storing a value-list in PostgreSQL. Usually, this should be done
by creating custom functions to take care of that.
The user specified statement will then be called by collectd with eight
arguments: time, host, plugin, plugin instance (or NULL), type, type instance
(or NULL), array of value names (data source names) and an array of the
values.
Two elements have been added to the config parser: A <Writer> block may be
used to name an SQL statement (specified using the 'Statement' option) to be
used for writing data. In a <Database> block, the new option 'Writer' may be
used to apply a writer to a database connection.
The current approach has two benefits: for one, a user may chose whatever
database layout best suits her needs. Also, it is very easy to experiment with
different approaches on how to structure the data in a database without the
need to modify the plugin. This can be done in SQL, which (hopefully) is the
language that people working with PostgreSQL databases like most ;-)
If it happens to turn out that some approach is rather superior, it may still
be re-implemented in a specific plugin in later versions.
src/collectd.conf.pod | diff | blob | history | |
src/postgresql.c | diff | blob | history |