我正在使用inputs.http_response模块来观察一些URL的状态。 实际上,只有一个URL,因为当我添加更多的时候,它会停止监视(并且事实上,在telegraf启动时会提示configuration错误)。
以下是我试过的两个例子:
[[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
并且
[[inputs.http_response]] address = ["https://www.example.com/index.html", "https://blog.example.com/index.html"] response_timeout = "5s" method = "GET" follow_redirects = false
而没有括号的是一样的。
任何build议如何监视多个url?
您必须通过更改input名称来更改telegrafinputconfiguration。 这可以通过创build一个名称后缀,前缀或甚至覆盖input名称本身来完成 – 必须为每个新的“http_response”input完成。 类似于这个例子:
[[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
在这个例子中,input名称将变成http_response_www和http_response_blog 。
更多信息请访问: https : //github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#input-configuration