【问题标题】:普罗米修斯 remote_write
【发布时间】:2022-01-22 23:16:39
【问题描述】:

我对这些组件不是很熟悉,但我正在尝试。 我在本地网络的 Ubuntu 服务器上安装了 Grafana 和 Prometheus。 Prometheus 正在使用 Node Exporter 收集自己的 Linux 指标,我可以使用 Prometheus 数据源在 Grafana 上显示指标。所以,我假设在这方面,对于本地使用,Prometheus 和 Grafana 都已正确设置。

我还在本地网络上的 Raspberry Pi 上安装了 Prometheus。 我确实设法将与 Raspberry Pi 相关的指标远程写入 Grafana Cloud。 现在我正在尝试将相同的指标远程写入上述 Ubuntu 服务器上的 Grafana,但我没有成功。

在 Raspberry Pi 上的 prometheus.yml 中,我已经替换了这个(正在工作):

#remote_write:
#- url: https://prometheus-blocks-prod-us-central1.grafana.net/api/prom/push
  #name: grafana_cloud_prometheus
  #basic_auth:
    #username: something
    #password: something

用这个:

remote_write:
- targets: "http://10.0.0.164/prometheus/remote/write"
  name: Prometheus
  basic_auth:
    username: admin
    password: admin

用户名和密码是在 Grafana 中设置的。

当我在 Pi 上重新启动 Prometheus 服务时,它失败了:

进程:8698 ExecStart=/home/pi/prometheus/prometheus --config.file=/home/pi/prometheus/prometheus.yml --storage.tsdb.path=/home/pi/prometheus/data --log.level=debug (code=e Main PID: 8698 (code=已退出,状态=2)

我不确定我做错了什么,或者我是否在这里遗漏了什么。 我确实尝试仅使用服务器 IP、IP 和端口来操纵目标,但我没有成功。 我将不胜感激一些帮助来解决这个问题。谢谢

【问题讨论】:

  • 检查日志以确保了解,但我敢打赌它是 remote_write 配置中的未知 (targets) 键。请改用url

标签: linux prometheus


【解决方案1】:

如果您需要将数据从 Raspberry PI 上的 Prometheus 写入 Ubuntu 服务器上的 Prometheus,那么您需要在 Ubuntu 上运行的 Prometheus 服务器上启用 remote_write 功能 - 请参阅these docs

我还建议在 Raspberry PI 的默认模式下尝试运行 Prometheus in Agent mode 或运行 vmagent 而不是 Prometheus。这些系统允许以与 Prometheus 相同的方式抓取 Prometheus 目标,但与 Prometheus 相比,它们使用的计算资源(CPU、RAM、磁盘空间、磁盘 IO)较少。

【讨论】:

  • 感谢您的指导。关于remote_write,我认为应该在我上面的问题中根据我的.yml 提取所做的Pi 上启用它。我还没有找到有关如何在服务器端启用 remote_write 的示例。你能举个例子吗?正如我所说,我不熟悉这些组件。谢谢
【解决方案2】:

您无法远程写入 Grafana(可视化软件),它通过查询 Prometheus 本身来访问数据。远程写入旨在用于写入其他 Prometheus 实例、长期存储后端(如 Thanos 和 Cortex)或 SaaS 平台(如 Grafana Cloud)。

您可能想要做的是将该 Prometheus 实例添加为 Grafana 中的数据源。

【讨论】:

  • 我已经将 Prometheus 数据源添加到服务器上的 Grafana 中。我正在努力将 Pi 上的 Prometheus 连接到运行 prometheus 实例的 Ubuntu 服务器以及 Grafana 和 Grafana 的 Prometheus 数据源。
  • 这有点令人困惑,但是,是的,我想将 Pi 上的 Prometheus 实例添加为服务器上 Grafana 的数据源。
猜你喜欢
  • 1970-01-01
  • 2017-09-03
  • 1970-01-01
  • 2022-10-17
  • 2022-12-02
  • 2022-12-17
  • 2020-01-10
  • 2020-11-12
  • 2019-12-18
相关资源
最近更新 更多