Add ability to generate config from available plugins

This commit is contained in:
Evan Phoenix
2015-05-18 15:10:11 -07:00
parent b2c5d95737
commit 82cbc4daa2
7 changed files with 195 additions and 23 deletions

View File

@@ -17,6 +17,39 @@ type Postgresql struct {
Servers []*Server
}
var sampleConfig = `
# specify servers via an array of tables
[[postgresql.servers]]
# specify address via a url matching:
# postgres://[pqgotest[:password]]@localhost?sslmode=[disable|verify-ca|verify-full]
# or a simple string:
# host=localhost user=pqotest password=... sslmode=...
#
# All connection parameters are optional. By default, the host is localhost
# and the user is the currently running user. For localhost, we default
# to sslmode=disable as well.
#
address = "localhost"
# A list of databases to pull metrics about. If not specified, metrics for all
# databases are gathered.
# databases = ["app_production", "blah_testing"]
# [[postgresql.servers]]
# address = "influx@remoteserver"
`
func (p *Postgresql) SampleConfig() string {
return sampleConfig
}
func (p *Postgresql) Description() string {
return "Read metrics from one or many postgresql servers"
}
var localhost = &Server{Address: "sslmode=disable"}
func (p *Postgresql) Gather(acc plugins.Accumulator) error {