Blackbox_exporter and SNI

Hi all,

I am having issues configuring blackbox_exporter to properly check site return code. I have IIS web server with several HTTPS sites (SNI host set) and this is my config:

- job_name: blackbox_http_get
    metrics_path: /probe
    params:
      module: [http_get_2xx]  # Use the GET module
    static_configs:
      - targets:
          - dev-chr01-iis.interna.lan
        labels:
          site: corehr.dev.externa.com
      - targets:
          - dev-chr01-iis.interna.lan
        labels:
          site: corehr-admin.dev.externa.com
      - targets:
          - dev-chr01-iis.interna.lan
        labels:
          site: workmates.dev.externa.com
      - targets:
          - dev-chr01-iis.interna.lan
        labels:
          site: corehr-hangfire.dev.externa.com
      - targets:
          - dev-chr01-iis.interna.lan
        labels:
          site: workmates-api.dev.externa.com
    relabel_configs:
      - source_labels: [site]
        target_label: __param_hostname  # Set the Host header (SNI)
      - source_labels: [__address__]
        target_label: __param_target
        replacement: https://$1/  # Use the internal server name as the target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # Blackbox Exporter's hostname:port

The issue is, if I intentionally show down the site (error 503) prometheus is showing state UP and if I click on the endpoint of one probe_success 0. So I am confused about this, maybe I am doing something wrong but I need some guidance what is wrong with my config.

Thanks everyone!

It’s working as expected, nameserver wasn’t set correctly on the host.