首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >利用telegraf中的http_response插件监控多个网址

利用telegraf中的http_response插件监控多个网址
EN

Server Fault用户
提问于 2017-11-03 17:59:11
回答 1查看 8.6K关注 0票数 2

我正在使用inputs.http_response模块来观察某些URL的状态。实际上,只有一个URL,因为当我添加更多的URL时,它就停止了监视(实际上,在telegraf启动时,它会注意到一个配置错误)。

以下是我尝试过的两个例子:

代码语言:javascript
复制
[[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

而且还

代码语言:javascript
复制
[[inputs.http_response]]
  address = ["https://www.example.com/index.html", "https://blog.example.com/index.html"]
  response_timeout = "5s"
  method = "GET"
  follow_redirects = false

没有括号也是一样。

有什么建议如何监控多个URL?

EN

回答 1

Server Fault用户

发布于 2017-11-17 16:24:24

您必须通过更改输入名称来更改telegraf输入配置。它可以通过创建名称后缀、前缀或甚至覆盖输入名称本身来完成--必须对每个新的"http_response“输入执行。类似于此示例的内容:

代码语言:javascript
复制
[[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

在本例中,输入名称将变成http_response_www和http_response_blog。

更多信息可在:https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#input-configuration中获得

票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/881732

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档