Prometheus scrap_config:目标包含“/&quot”,但普罗米修斯不接受

发布于 2025-02-03 18:40:04 字数 813 浏览 3 评论 0原文

我希望有人为我提供一些技巧,如何有效地解决我的问题。

我需要使用Prometheus.yml文件配置Prometheus刮擦。除了每个应用程序的URL之外,数百个安装的配置实际上必须相同。 那里有数字VM,每个VM都有几个安装,可以监视外壳(例如,具有10个安装的VM)。所有安装的度量路径是“/执行器/普罗米修斯”。 URL看起来好像

http://vm01.company.com:80/customer1/actuator/prometheus
http://vm01.company.com:80/customer2/actuator/prometheus
http://vm01.company.com:80/customer3/actuator/prometheus 
.....

我想做这样的事情:

> scrape_configs:
>     - job_name: scrape-vm-job
>       metrics_path: /actuator/prometheus
>       static_configs:
>         - targets: ['vm01.company.com:80/customer1', 'vm01.company.com:80/customer2', 'vm01.company.com:80/customer3']

但是,如果我尝试过,则不接受斜线。我可以将 /customer1添加到Metrics_path中,并且效果很好,但这意味着必须有大约500个类似的刮擦作业配置,而目标只有不同的目标。

有一种方法可以使普罗米修斯接受斜线作为目标的一部分?

I hope someone has a tip for me how to solve my problem in an efficient way.

I need to configure Prometheus scraping using the prometheus.yml file. The configuration has to be actually the same for hundreds of installations except the URL to each app.
There a numorous VMs and each VM there several installation that shell be monitored (e.g. a VM with 10 installations). The metric path for all installations is "/actuator/prometheus".
The URLs looks like

http://vm01.company.com:80/customer1/actuator/prometheus
http://vm01.company.com:80/customer2/actuator/prometheus
http://vm01.company.com:80/customer3/actuator/prometheus 
.....

I'd like to do something like this:

> scrape_configs:
>     - job_name: scrape-vm-job
>       metrics_path: /actuator/prometheus
>       static_configs:
>         - targets: ['vm01.company.com:80/customer1', 'vm01.company.com:80/customer2', 'vm01.company.com:80/customer3']

But if I try that, the slash is not accepted. I can add the /customer1 to the metrics_path and it works fine, but that would mean there have to be about 500 similar scraping job configs that only differ in the line for the target.

Ist there a way that Prometheus accepts the slash as part of the target?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国产ˉ祖宗 2025-02-10 18:40:04

我使用模板解决了问题。另一个值yaml文件正在提供所需的信息和模板循环通过文件,并为该特定安装创建刮擦作业。

I solved the problem using templating. An additional values yaml file is providing the needed information and the template loops through the file and creates the scraping job for that specific installation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文