On 26/03/2021 12:35, Julian Ade Putra wrote:
Hi Experts,

I want to know how to configure blackbox exporter configuration to monitor multiple source and target.

So, in my existing configuration to monitor 1 source and multiple target as below
_
_
_Source : _
prodenv27:9115

_Target : _
        - 1.1.1.1
        - 2.2.2.2

Now, i want to add new source and target in my current configuration :

_New Source : _
prodenv101:9115

_New Target : _
        - 3.3.3.3
        - 4.4.4.4

Should i create new job_name in prometheus config? Or can i have only one job_name for all blackbox icmp ?

Here is my current configuration :

  - job_name: 'blackbox_icmp'
    scrape_interval: 60s
    scrape_timeout: 30s
    metrics_path: /probe
    params:
      module: [icmp_ipv4]
    static_configs:
      - targets:
*        - 1.1.1.1*
*        - 2.2.2.2*
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: *prodenv27:9115*
*
*

Both options are possible.

The simplest option is to just have a 2nd job containing the second set of targets & blackbox URL.

However you can combine the two into a single job by encoding the blackbox URL within the targets. For example set the targets to blackbox1:target1, blackbox1:target2, blackbox2:target3. You can then split using regexes to set the bit before the colon to __param_target and the bit after to __address__ (with the :9115 suffix).

--
Stuart Clark

--
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/678727b4-c717-82b8-d64f-8d1c45b1aa24%40Jahingo.com.

Reply via email to