繁体   English   中英

使用 telegraf 和 prometheus 进行监控

[英]Monitoring using telegraf and prometheus

如何使用 prometheus 和 telegraf 从我的电脑监控另一台服务器? 我需要在他们两个上安装电报吗?

您的问题将受益于更精确的信息,包括对您尝试过的内容的描述(甚至是假设)。 因此,它可能会被标记。

直到那时...

Telegraf 似乎支持 Prometheus 作为 output 插件( 链接)。

所以你应该能够:

  1. 运行配置了 Prometheus 的 Telegraf 作为 output 插件(见上文)
  2. 运行配置为抓取 #1 公开的指标的 Prometheus

假设您使用以下形式的 Telegraf 配置:

[[outputs.prometheus_client]]
  ## Address to listen on.
  listen = ":9273"

您应该能够从 Telegraf 运行的主机浏览|curl http://localhost:9273/metrics以查看它公开的指标。

注意如果不是localhost ( 127.0.0.1 ),则将localhost替换为主机的名称|地址。

然后你需要配置一个 Prometheus 抓取目标来抓取 Telegraf 指标:

scrape_configs:
  # Telegraf
  - job_name: "telegraf-agent"
    static_configs:
      - targets:
          - "localhost:9273"
  # Self
  - job_name: "prometheus-server"
    static_configs:
      - targets:
          - "localhost:9090"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM