This is where a configuration management software like Ansible comes in.
You can write the configuration with a for loop that expands the lists.

https://galaxy.ansible.com/ui/repo/published/prometheus/prometheus/

On Sun, Feb 18, 2024 at 1:08 AM Alexander Wilke <nachtfalk...@gmail.com>
wrote:

> Hello,
>
> In our DataCenter we have different security zones. In each zone I want to
> place a blackbox_exporter. The goal is that each blackbox_exporter monitors
> the same destinations eg. same DNS Server or same webserver. All exporters
> are controlled by one single prometheus server.
>
> If someone complains that something is wrong, slow or whatever I want to
> have the possibility to compare each blackbox_exporter to understand if
> there was an issue with the service (destnation) or the newtwork or
> something else.
>
> I will have 26 blackbox exporter system in the DC. Each should use the
> same destinations, protocols, etc. Is there a way to simplify my
> configuration to not have 26 different configuration parts but merge this
> into one part?
>
> at the moment the configuration is only different in three places:
> - job name
> - custom label
> - replacement (IP of blackbox_exporter)
>
> Here an example which would result in 26 different configuration parts and
> ideally I only want to have one configuration part because if I want to add
> another test then I need to edit all 26 files again.
>
>
>
>
> #===============================================================================================================================
>
>   - job_name: 'blackbox_job_01'
>     scrape_interval: 15s
>     scrape_timeout: 14s
>     metrics_path: /probe
>     params:
>       module: [http_post_2xx]
>     static_configs:
>       - targets:
>         - https://hostname1.domain
>         - https://hostname2.domain
>         - https://hostname3.domain
>         labels:
>            source_group: 'blackbox_job_01'
>
>     relabel_configs:
>       - source_labels: [__address__]
>         target_label: __param_target
>       - source_labels: [__param_target]
>         target_label: instance
>       - target_label: __address__
>         replacement: blackbox_job_01.domain:9115
>
>
> #===============================================================================================================================
>
>   - job_name: 'blackbox_job_02'
>     scrape_interval: 15s
>     scrape_timeout: 14s
>     metrics_path: /probe
>     params:
>       module: [http_post_2xx]
>     static_configs:
>       - targets:
>         - https://hostname1.domain
>         - https://hostname2.domain
>         - https://hostname3.domain
>         labels:
>            source_group: 'blackbox_job_02'
>
>     relabel_configs:
>       - source_labels: [__address__]
>         target_label: __param_target
>       - source_labels: [__param_target]
>         target_label: instance
>       - target_label: __address__
>         replacement: blackbox_job_02.domain:9115
>
>
> #===============================================================================================================================
>
> --
> 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 prometheus-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/5495f9a4-e80a-4dba-a601-86199221f6f6n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/5495f9a4-e80a-4dba-a601-86199221f6f6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CABbyFmpK%2BfqweZbD6nKEGU_LDsB0GVCnc6CptJxaqL2sYmuZAg%40mail.gmail.com.

Reply via email to