On Friday, 7 August 2020 09:16:18 UTC+1, Eric wrote:
>
> My Question:
> The targets have  to be defined in the prometheus.yml, they can't be 
> defined in blackbox.yml as far as I understand.
>
>
The targets are defined as prometheus targets, but they don't have to be 
static_sd_configs.  They can be in other files using file_sd_configs.
 

> Is there a possibility to split the prometheus.yml config, in oder to have 
> more configs with different file permissions?
>
>
Yes.  file_sd_configs can point to one or more target files.
 
Doing this neatly involves using a little label rewriting.  Here is a 
config you can base on:

  - job_name: blackbox
    file_sd_configs:
      - files:
        - /etc/prometheus/targets.d/foo_targets.yml
        - /etc/prometheus/targets.d/bar_targets.yml
    metrics_path: /probe
    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: 127.0.0.1:9115  # Blackbox exporter

Then in the targets files you can write things like this:

- labels:
    module: http_2xx
  targets:
   - http://www.google.com/
   - http://www.youtube.com/
- labels:
    module: http_3xx
  targets:
   - http://www.example.com

-- 
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/c22b4d5e-e143-4854-a6d9-a68e66059866o%40googlegroups.com.

Reply via email to