prometheusprometheus-blackbox-exporter

Prometheus relabel_configs issue


My labels:

__address__: "https://example.com/health"
__metrics_path__: "/probe"
__param_module: "http_200"
__scheme__: "http"
job: "black-box"

My config:

relabel_configs:
  - source_labels: [__address__]
    target_label: __param_target
  - source_labels: [__param_target]
    target_label: instance
  - source_labels: [__address__]
    regex:  '\/health'
    replacement: 'my new label'
    target_label: service
  - source_labels: [module]
    target_label: __param_module
  - target_label: __address__
    replacement: newdomain:9115

I cannot understand why regex: '\/health' does not match and the service target is not created.

Thank you


Solution

  • The regex should match the whole string, wchich is constructed from values of labels passed to source_labels list concatenated with the separator (by default it is set to ;). So, in your case the regex should look like regex: ".+/health" .

    P.S. I'd recommend using this service for debugging of Prometheus target relabeling.