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 9bc13f143e
commit 09153c815c
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
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 # HTTP/HTTPS request given an address a method and a timeout
[[inputs.http_response]] [[inputs.http_response]]
## Server address (default http://localhost) ## Server address (default http://localhost)
address = "http://github.com" # address = "http://localhost"
## Set response_timeout (default 5 seconds) ## Set response_timeout (default 5 seconds)
response_timeout = "5s" # response_timeout = "5s"
## HTTP Request Method ## HTTP Request Method
method = "GET" # method = "GET"
## Whether to follow redirects from the server (defaults to false) ## Whether to follow redirects from the server (defaults to false)
follow_redirects = true # follow_redirects = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
## Optional HTTP Request Body ## Optional HTTP Request Body
# body = ''' # body = '''
# {'fake':'data'} # {'fake':'data'}
# ''' # '''
## Optional substring or regex match in body of the response ## Optional substring or regex match in body of the response
## response_string_match = "\"service_status\": \"up\"" # response_string_match = "\"service_status\": \"up\""
## response_string_match = "ok" # response_string_match = "ok"
## response_string_match = "\".*_status\".?:.?\"up\"" # response_string_match = "\".*_status\".?:.?\"up\""
## Optional SSL Config ## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem" # ssl_ca = "/etc/telegraf/ca.pem"
@ -34,6 +35,10 @@ This input plugin will test HTTP/HTTPS connections.
# ssl_key = "/etc/telegraf/key.pem" # ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification ## Use SSL but skip chain & host verification
# insecure_skip_verify = false # insecure_skip_verify = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
``` ```
### Measurements & Fields: ### Measurements & Fields:
@ -52,6 +57,5 @@ This input plugin will test HTTP/HTTPS connections.
### Example Output: ### 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 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 = ` var sampleConfig = `
## Server address (default http://localhost) ## Server address (default http://localhost)
address = "http://github.com" # address = "http://localhost"
## Set response_timeout (default 5 seconds) ## Set response_timeout (default 5 seconds)
response_timeout = "5s" # response_timeout = "5s"
## HTTP Request Method ## HTTP Request Method
method = "GET" # method = "GET"
## Whether to follow redirects from the server (defaults to false) ## Whether to follow redirects from the server (defaults to false)
follow_redirects = true # follow_redirects = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
## Optional HTTP Request Body ## Optional HTTP Request Body
# body = ''' # body = '''
# {'fake':'data'} # {'fake':'data'}
# ''' # '''
## Optional substring or regex match in body of the response ## Optional substring or regex match in body of the response
## response_string_match = "\"service_status\": \"up\"" # response_string_match = "\"service_status\": \"up\""
## response_string_match = "ok" # response_string_match = "ok"
## response_string_match = "\".*_status\".?:.?\"up\"" # response_string_match = "\".*_status\".?:.?\"up\""
## Optional SSL Config ## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem" # ssl_ca = "/etc/telegraf/ca.pem"
@ -73,6 +74,10 @@ var sampleConfig = `
# ssl_key = "/etc/telegraf/key.pem" # ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification ## Use SSL but skip chain & host verification
# insecure_skip_verify = false # insecure_skip_verify = false
## HTTP Request Headers (all values must be strings)
# [inputs.http_response.headers]
# Host = "github.com"
` `
// SampleConfig returns the plugin SampleConfig // SampleConfig returns the plugin SampleConfig