简体   繁体   English

在Prometheus Blackbox导出器中为每个目标配置唯一名称

[英]Configure unique name per target in Prometheus Blackbox exporter

In Prometheus with blackbox exporter I have managed to configure 10+ URL for application availability, All of them are identified via their URL some of them are longer than the example shown below So Instead of display URL as an instance name how can I specify each with unique label. 在带有黑匣子导出器的Prometheus中,我设法为应用程序可用性配置了10个以上的URL,所有这些URL均通过其URL进行标识,其中一些比下面显示的示例更长,因此,除了将URL显示为实例名称之外,我如何使用唯一标签。

For example 例如

static_configs:
  - targets:
    - https://www.google.co.in/ # called as GoogleIndia
    - https://www.google.co.uk/ # called as GoogleUK
    - https://www.google.fr/    # called as GoogleFrance

You can use metric_relabel_configs to construct an instance (or completely new) label based on the instance name you specified, as described in this blog post . 您可以使用metric_relabel_configs根据您指定的实例名称构造一个instance (或全新的)标签,如本博客文章中所述

Or you can specify your targets like this, assigning them arbitrary labels in the process: 或者,您可以像这样指定目标,在过程中为它们分配任意标签:

static_configs:
  - targets: ['https://www.google.co.in/']
    labels:
      name: `GoogleIndia`
  - targets: ['https://www.google.co.uk/']
    labels:
      name: `GoogleUK`
  - targets: ['https://www.google.fr/']
    labels:
      name: `GoogleFrance`

It's more verbose, but also easier to understand and more powerful. 它更冗长,但更易于理解,功能更强大。

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

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