From 457473bbee60db5a8e3ed7aa548879bf43405ebe Mon Sep 17 00:00:00 2001 From: Dennis Dryden Date: Wed, 8 Mar 2017 17:21:43 +0000 Subject: [PATCH 1/2] Add configuration docs to Postgresql input plugin Add configuration docs to PostgreSQL input plugin README (mostly from the source code) though I've not included the configuration example that seems to use all he connections on the database[1]. [1] https://github.com/influxdata/telegraf/issues/2410 --- plugins/inputs/postgresql/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/inputs/postgresql/README.md b/plugins/inputs/postgresql/README.md index e309aa80f0ffa..39b9e416ffc78 100644 --- a/plugins/inputs/postgresql/README.md +++ b/plugins/inputs/postgresql/README.md @@ -29,3 +29,28 @@ _* value ignored and therefore not recorded._ More information about the meaning of these metrics can be found in the [PostgreSQL Documentation](http://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-DATABASE-VIEW) + +## Configruation +Specify address via a url matching: + + `postgres://[pqgotest[:password]]@localhost[/dbname]?sslmode=[disable|verify-ca|verify-full]` + +All connection parameters are optional. Without the dbname parameter, the driver will default to a database with the same name as the user. This dbname is just for instantiating a connection with the server and doesn't restrict the databases we are trying +to grab metrics for. + + `address = "host=localhost user=postgres sslmode=disable"` + +A list of databases to explicitly ignore. If not specified, metrics for all databases are gathered. Do NOT use with the 'databases' option. + + `ignored_databases = ["postgres", "template0", "template1"]` + +A list of databases to pull metrics about. If not specified, metrics for all databases are gathered. Do NOT use with the 'ignore_databases' option. + + `databases = ["app_production", "testing"]` + +### Configuration example +``` +[[inputs.postgresql]] + address = "postgres://telegraf@localhost/someDB" + ignored_databases = ["template0", "template1"] +``` From 421fa195e8c5c384d16b91dde5721f6cddd075c0 Mon Sep 17 00:00:00 2001 From: Dennis Dryden Date: Thu, 9 Mar 2017 10:24:37 +0000 Subject: [PATCH 2/2] Fix typo in readme and sampleConfig string. --- plugins/inputs/postgresql/README.md | 7 ++----- plugins/inputs/postgresql/postgresql.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/inputs/postgresql/README.md b/plugins/inputs/postgresql/README.md index 39b9e416ffc78..aed041bc6222d 100644 --- a/plugins/inputs/postgresql/README.md +++ b/plugins/inputs/postgresql/README.md @@ -35,16 +35,13 @@ Specify address via a url matching: `postgres://[pqgotest[:password]]@localhost[/dbname]?sslmode=[disable|verify-ca|verify-full]` -All connection parameters are optional. Without the dbname parameter, the driver will default to a database with the same name as the user. This dbname is just for instantiating a connection with the server and doesn't restrict the databases we are trying -to grab metrics for. - - `address = "host=localhost user=postgres sslmode=disable"` +All connection parameters are optional. Without the dbname parameter, the driver will default to a database with the same name as the user. This dbname is just for instantiating a connection with the server and doesn't restrict the databases we are trying to grab metrics for. A list of databases to explicitly ignore. If not specified, metrics for all databases are gathered. Do NOT use with the 'databases' option. `ignored_databases = ["postgres", "template0", "template1"]` -A list of databases to pull metrics about. If not specified, metrics for all databases are gathered. Do NOT use with the 'ignore_databases' option. +A list of databases to pull metrics about. If not specified, metrics for all databases are gathered. Do NOT use with the 'ignored_databases' option. `databases = ["app_production", "testing"]` diff --git a/plugins/inputs/postgresql/postgresql.go b/plugins/inputs/postgresql/postgresql.go index 7019762ed2dd8..7c854dfd3885a 100644 --- a/plugins/inputs/postgresql/postgresql.go +++ b/plugins/inputs/postgresql/postgresql.go @@ -43,7 +43,7 @@ var sampleConfig = ` # ignored_databases = ["postgres", "template0", "template1"] ## A list of databases to pull metrics about. If not specified, metrics for all - ## databases are gathered. Do NOT use with the 'ignore_databases' option. + ## databases are gathered. Do NOT use with the 'ignored_databases' option. # databases = ["app_production", "testing"] `