【问题标题】:Monitoring using telegraf and prometheus使用 telegraf 和 prometheus 进行监控
【发布时间】:2021-06-10 14:07:14
【问题描述】:

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

【问题讨论】:

    标签: alert prometheus monitoring telegraf


    【解决方案1】:

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

    在那之前……

    Telegraf 似乎支持 Prometheus 作为输出插件 (link)。

    所以你应该能够:

    1. 运行配置了 Prometheus 的 Telegraf 作为输出插件(见上文)
    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"
    

    【讨论】:

      猜你喜欢
      • 2022-10-17
      • 1970-01-01
      • 2020-09-08
      • 1970-01-01
      • 1970-01-01
      • 2020-08-09
      • 2022-11-04
      • 2018-05-22
      • 2023-03-11
      相关资源
      最近更新 更多