rdev1991
rdev1991

Reputation: 103

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

Upvotes: 9

Views: 7020

Answers (1)

Alin Sînpălean
Alin Sînpălean

Reputation: 10084

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.

Upvotes: 17

Related Questions