本文介绍了将目标动态添加到 Prometheus 配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 Prometheus 中的特定工作,典型的配置似乎是这样的:

For a particular job in Prometheus, it seems like the typical config is something like this:

static_configs:
- targets: ['localhost:9090']

但是如果我想要一个动态的主机列表,那里的方法是什么?我正在查看 scrape_config 但这似乎并没有完成我所追求的(除非我误读了?).

But in the case where I want a dynamic list of hosts, what would be the approach there? I was looking at scrape_config but that doesn't seem to accomplish what I'm after (unless I'm misreading?).

先谢谢你!

推荐答案

如果提供的服务发现机制之一不能满足您的需求,您可以使用 file_sd_configs 以动态提供目标.

If one of the provided service discovery mechanisms doesn't already do what you need, you can use file_sd_configs to provide targets on the fly.

这篇关于将目标动态添加到 Prometheus 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:27