[blacbox_exporter - icmp] Multiple Source and Target

198 views
Skip to first unread message

Julian Ade Putra

unread,
Mar 26, 2021, 8:35:34 AM3/26/21
to Prometheus Users
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


Thanks,
Julian

Stuart Clark

unread,
Mar 26, 2021, 9:14:56 AM3/26/21
to Julian Ade Putra, Prometheus Users

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
Reply all
Reply to author
Forward
0 new messages