On 15 May 02:31, Venkata Sandeep wrote:
> Hi Prometheus USers,
> 
> We have list of targets dynamically updated in the file called.target.yaml
> 
> - tagets
>   - host1.abc.com
>   - host2.abc.com
>   - host3.abc.com
> 
> We would like to use targets.yaml file in multiple jobs as file_sd_configs 
> (service discovery).
> 
> We want to scrape on different ports using the same targets file as below. 
> How to achieve it?

Hi, 

You can use relabel config

- job_name: get-port-9001 //want to read metrics for port 9001
  file_sd_configs:
  - files:
    - targets.yaml   
  relabel_configs:
    - source_labels: [__address__]
      target_label: __address__
      replacement: "${1}:9001"
- job_name: get-port-9002 //want to read metrics for port 9002
  file_sd_configs:
  - files:
    - targets.yaml   
  relabel_configs:
    - source_labels: [__address__]
      target_label: __address__
      replacement: "${1}:9002"

Regards

> 
> - job_name: get-port-9001 //want to read metrics for port 9001
>   file_sd_configs:
>   - files:
>     - targets.yaml   
> - job_name: get-port-9002 //want to read metrics for port 9002
>   file_sd_configs:
>   - files:
>     - targets.yaml   
> - job_name: get-port-9003 //want to read metrics for port 9003
>   file_sd_configs:
>   - files:
>     - targets.yaml   
> 
> Thanks
> Sandeep
> 
> -- 
> 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/97463959-a6f8-4af4-8bcd-9926c3cdda7a%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/20200515094822.GA156662%40oxygen.

Reply via email to