Add default url for http output (#5976)
This commit is contained in:
parent
4cfd70b6c0
commit
63916ae1cf
|
@ -9,7 +9,7 @@ data formats. For data_formats that support batching, metrics are sent in batch
|
||||||
# A plugin that can transmit metrics over HTTP
|
# A plugin that can transmit metrics over HTTP
|
||||||
[[outputs.http]]
|
[[outputs.http]]
|
||||||
## URL is the address to send metrics to
|
## URL is the address to send metrics to
|
||||||
url = "http://127.0.0.1:8080/metric"
|
url = "http://127.0.0.1:8080/telegraf"
|
||||||
|
|
||||||
## Timeout for HTTP message
|
## Timeout for HTTP message
|
||||||
# timeout = "5s"
|
# timeout = "5s"
|
||||||
|
@ -40,12 +40,12 @@ data formats. For data_formats that support batching, metrics are sent in batch
|
||||||
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
|
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
|
||||||
# data_format = "influx"
|
# data_format = "influx"
|
||||||
|
|
||||||
|
## HTTP Content-Encoding for write request body, can be set to "gzip" to
|
||||||
|
## compress body or "identity" to apply no encoding.
|
||||||
|
# content_encoding = "identity"
|
||||||
|
|
||||||
## Additional HTTP headers
|
## Additional HTTP headers
|
||||||
# [outputs.http.headers]
|
# [outputs.http.headers]
|
||||||
# # Should be set manually to "application/json" for json data_format
|
# # Should be set manually to "application/json" for json data_format
|
||||||
# Content-Type = "text/plain; charset=utf-8"
|
# Content-Type = "text/plain; charset=utf-8"
|
||||||
|
|
||||||
## HTTP Content-Encoding for write request body, can be set to "gzip" to
|
|
||||||
## compress body or "identity" to apply no encoding.
|
|
||||||
# content_encoding = "identity"
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -19,9 +19,13 @@ import (
|
||||||
"golang.org/x/oauth2/clientcredentials"
|
"golang.org/x/oauth2/clientcredentials"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultURL = "http://127.0.0.1:8080/telegraf"
|
||||||
|
)
|
||||||
|
|
||||||
var sampleConfig = `
|
var sampleConfig = `
|
||||||
## URL is the address to send metrics to
|
## URL is the address to send metrics to
|
||||||
url = "http://127.0.0.1:8080/metric"
|
url = "http://127.0.0.1:8080/telegraf"
|
||||||
|
|
||||||
## Timeout for HTTP message
|
## Timeout for HTTP message
|
||||||
# timeout = "5s"
|
# timeout = "5s"
|
||||||
|
@ -52,14 +56,14 @@ var sampleConfig = `
|
||||||
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
|
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
|
||||||
# data_format = "influx"
|
# data_format = "influx"
|
||||||
|
|
||||||
|
## HTTP Content-Encoding for write request body, can be set to "gzip" to
|
||||||
|
## compress body or "identity" to apply no encoding.
|
||||||
|
# content_encoding = "identity"
|
||||||
|
|
||||||
## Additional HTTP headers
|
## Additional HTTP headers
|
||||||
# [outputs.http.headers]
|
# [outputs.http.headers]
|
||||||
# # Should be set manually to "application/json" for json data_format
|
# # Should be set manually to "application/json" for json data_format
|
||||||
# Content-Type = "text/plain; charset=utf-8"
|
# Content-Type = "text/plain; charset=utf-8"
|
||||||
|
|
||||||
## HTTP Content-Encoding for write request body, can be set to "gzip" to
|
|
||||||
## compress body or "identity" to apply no encoding.
|
|
||||||
# content_encoding = "identity"
|
|
||||||
`
|
`
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -218,6 +222,7 @@ func init() {
|
||||||
return &HTTP{
|
return &HTTP{
|
||||||
Timeout: internal.Duration{Duration: defaultClientTimeout},
|
Timeout: internal.Duration{Duration: defaultClientTimeout},
|
||||||
Method: defaultMethod,
|
Method: defaultMethod,
|
||||||
|
URL: defaultURL,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue