On Friday, 15 May 2020 10:48:28 UTC+1, Julien Pivotto wrote:
>
> 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"
>
>
And with a couple of extra lines, you can keep the port out of the instance
label <https://www.robustperception.io/controlling-the-instance-label>.
The metrics are still distinguished by their "job" label.
- 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: instance* - 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: instance*
- source_labels: [__address__]
target_label: __address__
replacement: "${1}:9002"
--
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/4f6118a4-d157-4900-a46a-39f8d6e17681%40googlegroups.com.