How to assign a label to an instance?

Hi all,

I’m trying to add labels to a blackbox exporter job

The working configuration is

# MODIFICATO Blackbox exporter da gitub https://github.com/prometheus/blackbox_exporter
  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - https://www.google.com   # Target to probe with https.
        - https://www.cloudflare.com   # Target to probe with https.
        - https://www.github.com # Target to probe with https.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # The blackbox exporter's real hostname:port.
  - job_name: 'blackbox_exporter'  # collect blackbox exporter's operational metrics.
    static_configs:
      - targets: ['127.0.0.1:9115']

I want to see in grafana “google-dns” instead of the instance name with the complete URL

I tried to assign labels to targets but this didn’t work

This code

# MODIFICATO Blackbox exporter da gitub https://github.com/prometheus/blackbox_exporter
  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - https://www.google.com   # Target to probe with https.
          labels:
            name: google-dns
        - https://www.cloudflare.com   # Target to probe with https.
          labels:
            name: cloudflere-dns
        - https://www.github.com # Target to probe with https.
          labels:
            name: github
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # The blackbox exporter's real hostname:port.
  - job_name: 'blackbox_exporter'  # collect blackbox exporter's operational metrics.
    static_configs:
      - targets: ['127.0.0.1:9115']

prevents prometheus from starting saying in systemctl status that there is an error in the yml file.

How can I verify the correctness of the yml file?

How can I assign a label to a target?