2

I am using the inputs.http_response module to watch the status of some URL's. Actually, only one URL, because when I add more, it stops monitoring (and, indeed, bails out at telegraf startup noting a config error).

Here are two examples I've tried:

[[inputs.http_response]]
  address = "https://www.example.com/index.html"
  response_timeout = "5s"
  method = "GET"
  follow_redirects = false

[[inputs.http_response]]
  address = "https://blog.example.com/index.html"
  response_timeout = "5s"
  method = "GET"
  follow_redirects = false

and also

[[inputs.http_response]]
  address = ["https://www.example.com/index.html", "https://blog.example.com/index.html"]
  response_timeout = "5s"
  method = "GET"
  follow_redirects = false

and the same without the brackets.

Any suggestions how to monitor more than one URL?

jma
  • 415
  • 5
  • 15

1 Answers1

3

You have to change the telegraf input configuration, by changing the input name. It can be done by creating a name suffix, prefix or even overwriting the input name itself - it has to be done for each new "http_response" input. Something similar to this example:

[[inputs.http_response]]
    name_suffix = "_www"
    address = "https://www.example.com/index.html"
    response_timeout = "10s"
    method = "GET"
    follow_redirects = false

[[inputs.http_response]]
    name_suffix = "_blog"
    address = "https://blog.example.com/index.html"
    response_timeout = "10s"
    method = "GET"
    follow_redirects = false

In this example, the input names will become http_response_www and http_response_blog.

More info available in: https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#input-configuration