Hi Julien,

One query.

Using this regex combination that you mentioned, the module is getting set 
to http_healthcheck itself for all the targets even if I specify a 
different module for some of the targets. 

On Friday, October 23, 2020 at 11:31:12 AM UTC+5:30 [email protected] 
wrote:

> Thanks, Julien.
>
> On Friday, October 23, 2020 at 1:38:18 AM UTC+5:30 Julien Pivotto wrote:
>
>> On 22 Oct 10:52, [email protected] wrote:
>> > Hi. I want to use a single job and a file for probing targets with 
>> > different modules. My job currently looks like this.
>> > 
>> > - job_name: 'blackbox_TestingAllInSameFile'
>> > metrics_path: /probe
>> > file_sd_configs:
>> > - files:
>> > - /root/test.yml
>> > relabel_configs:
>> > - source_labels: [__address__]
>> > target_label: __param_target
>> > - source_labels: [__param_target]
>> > target_label: instance
>> > - source_labels: [module]
>> > target_label: __param_module
>> > - target_label: __address__
>> > replacement: 172.20.10.99:9115
>> > scrape_interval: 10s
>> > 
>> > My target file looks like this:
>> > 
>> > - targets:
>> > - t1
>> > - t2
>> > labels:
>> > module: 'http_healthcheck'
>> > checkname: 'a'
>> > cluster: 'b'
>> > node: 'c'
>> > env: 'PROD'
>> > 
>> > My http_healthcheck module will be used for most of the targets. So, is 
>> > there any way to make it as a fallback module and not define module 
>> label 
>> > everytime for this particular module? I mean I want to define the 
>> module 
>> > label only when it is anything other than http_healthcheck.
>> > Is there any way we could achieve this using relabel_configs?
>>
>> Yes, you could do:
>>
>> - source_labels: [__param_module]
>> regex: '()'
>> replacement: 'http_healthcheck'
>> target_label: __param_module
>>
>> > 
>> > Thanks in advance!
>> > 
>> > -- 
>> > 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/990ec69c-5214-455c-ab10-c64a6a59ba46n%40googlegroups.com
>> .
>>
>>
>> -- 
>> Julien Pivotto
>> @roidelapluie
>>
>

-- 
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/e2e0786f-9557-4eb8-a572-935aac9b0083n%40googlegroups.com.

Reply via email to