Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 476
rdev1991 Avatar asked Oct 23 '18 02:10

rdev1991


People also ask

How do you set the Prometheus target?

Install [prometheus-node-exporter] package that includes function to get general resource on the System like CPU or Memory usage on the Node you'd like to add. Add setting on Prometheus Server Config. Access to the Prometheus Web UI and click [Status] - [Targets] to verify new nodes are listed.

What is blackbox Exporter in Prometheus?

The Prometheus Blackbox exporter allows endpoints exploration over several protocols, such as HTTP(S), DNS, TCP, and ICMP. This exporter generates multiple metrics on your configured targets, like general endpoint status, response time, redirect information, or certificate expiration dates.

How do I install and configure Blackbox Exporter for Prometheus?

To install a blackbox exporter dashboard: https://grafana.com/dashboards/7587, create a new dashboard, select import, provide the ID: 7587 , select the prometheus datasource and select save.


1 Answers

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.

like image 71
Alin Sînpălean Avatar answered Sep 18 '22 11:09

Alin Sînpălean