Made the apache input’s urls parameter optional by using a reasonable default for most users (#1288)

This commit is contained in:
Martin 2016-05-27 17:12:36 +02:00 committed by Cameron Sparr
parent ca504a19ec
commit 984b6cb0fb
3 changed files with 7 additions and 1 deletions

View File

@ -454,6 +454,7 @@
# # Read Apache status information (mod_status)
# [[inputs.apache]]
# ## An array of Apache status URI to gather stats.
# ## Default is "http://localhost/server-status?auto".
# urls = ["http://localhost/server-status?auto"]

View File

@ -1,7 +1,7 @@
# Telegraf plugin: Apache
#### Plugin arguments:
- **urls** []string: List of apache-status URLs to collect from.
- **urls** []string: List of apache-status URLs to collect from. Default is "http://localhost/server-status?auto".
#### Description

View File

@ -21,6 +21,7 @@ type Apache struct {
var sampleConfig = `
## An array of Apache status URI to gather stats.
## Default is "http://localhost/server-status?auto".
urls = ["http://localhost/server-status?auto"]
`
@ -33,6 +34,10 @@ func (n *Apache) Description() string {
}
func (n *Apache) Gather(acc telegraf.Accumulator) error {
if len(n.Urls) == 0 {
n.Urls = []string{"http://localhost/server-status?auto"}
}
var wg sync.WaitGroup
var outerr error