Move http_response headers to end of configuration.

If the subtable comes before other options, they will be placed in the
subtable.
This commit is contained in:
Daniel Nelson 2017-08-15 11:50:08 -07:00
parent 064071ba51
commit 0d6aca44fc
2 changed files with 30 additions and 21 deletions

View File

@ -8,25 +8,26 @@ This input plugin will test HTTP/HTTPS connections.
# HTTP/HTTPS request given an address a method and a timeout
[[inputs.http_response]]
## Server address (default http://localhost)
address = "http://github.com"
# address = "http://localhost"
## Set response_timeout (default 5 seconds)
response_timeout = "5s"
# response_timeout = "5s"
## HTTP Request Method
method = "GET"
# method = "GET"
## Whether to follow redirects from the server (defaults to false)
follow_redirects = true
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
# follow_redirects = false
## Optional HTTP Request Body
# body = '''
# {'fake':'data'}
# '''
## Optional substring or regex match in body of the response
## response_string_match = "\"service_status\": \"up\""
## response_string_match = "ok"
## response_string_match = "\".*_status\".?:.?\"up\""
# response_string_match = "\"service_status\": \"up\""
# response_string_match = "ok"
# response_string_match = "\".*_status\".?:.?\"up\""
## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem"
@ -34,6 +35,10 @@ This input plugin will test HTTP/HTTPS connections.
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
```
### Measurements & Fields:
@ -52,6 +57,5 @@ This input plugin will test HTTP/HTTPS connections.
### Example Output:
```
$ ./telegraf --config telegraf.conf --input-filter http_response --test
http_response,method=GET,server=http://www.github.com http_response_code=200i,response_time=6.223266528 1459419354977857955
```

View File

@ -47,25 +47,26 @@ func (h *HTTPResponse) Description() string {
var sampleConfig = `
## Server address (default http://localhost)
address = "http://github.com"
# address = "http://localhost"
## Set response_timeout (default 5 seconds)
response_timeout = "5s"
# response_timeout = "5s"
## HTTP Request Method
method = "GET"
# method = "GET"
## Whether to follow redirects from the server (defaults to false)
follow_redirects = true
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
# follow_redirects = false
## Optional HTTP Request Body
# body = '''
# {'fake':'data'}
# '''
## Optional substring or regex match in body of the response
## response_string_match = "\"service_status\": \"up\""
## response_string_match = "ok"
## response_string_match = "\".*_status\".?:.?\"up\""
# response_string_match = "\"service_status\": \"up\""
# response_string_match = "ok"
# response_string_match = "\".*_status\".?:.?\"up\""
## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem"
@ -73,6 +74,10 @@ var sampleConfig = `
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
`
// SampleConfig returns the plugin SampleConfig