简体   繁体   中英

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.

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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