> blackbox exporter requires `metric_relabel_configs` setup

You don't need metric_relabel_configs, but relabel_configs is what you 
need.  relabel_configs is done *before* scraping, metric_relabel_configs is 
*after* scraping.

>  setting `__address__` label didn't work for me:

No it won't.  "targets" is what sets the __address__.

What are you trying to do precisely - I am guessing you are trying to probe 
the same site, "example.com", via two different exporters?

A simple way is to use two different jobs:

  - job_name: blackbox_eu
    metrics_path: /probe
    params:
      module: [http_text_html]
    static_configs:
      - targets:
          - example.com
          - example.net
        labels:
          src: eu
          env: dev
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
      - source_labels: [__address__]
        target_label: __param_target
      - target_label: __address__
        replacement: blackbox-eu:9449  # The blackbox exporter's real 
hostname:port.

  - job_name: blackbox_us
    metrics_path: /probe
    params:
      module: [http_text_html]
    static_configs:
      - targets:
          - example.com
          - example.net
        labels:
          src: us
          env: dev
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
      - source_labels: [__address__]
        target_label: __param_target
      - target_label: __address__
        replacement: blackbox-us:9449  # The blackbox exporter's real 
hostname:port.

I recommend making an explicit "module" label:

  - job_name: blackbox_eu
    metrics_path: /probe
    static_configs:
      - targets:
          - example.com
          - example.net
        labels:
          src: eu
          env: dev
          module: http_text_html
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [module]
        target_label: __param_module
      - target_label: __address__
        replacement: blackbox-eu:9449  # The blackbox exporter's real 
hostname:port.

This lets you probe the same host with multiple modules (you need a 
"module" label to distinguish the timeseries), and you can have different 
targets with different modules all in the same job.

      - targets:
          - example.com
        labels:
          module: http_text_html
      - targets:
          - example.net
        labels:
          module: icmp


Finally, unless you only ever have one or two targets, I suggest you use 
file_sd_configs rather than static_configs.  This means you can change the 
targets without touching the main config file - and prometheus will pick up 
the changes automatically, without you having to send a HUP signal.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/450c0961-d2a4-47e2-ad51-1ffe515ea85bo%40googlegroups.com.

Reply via email to