- job_name: 'kubernetes-test'
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: (.+)
replacement:
http://10.131.0.2:1111 http://10.131.0.2:2222 http://10.131.0.2:3333 http://10.131.0.2:4444
I would like to split up the pod IP and append the port number I would like to scrape. e.g. anly 10.131.0.2:2222
I don't seem to be able to make use of the regexes...
I assume what I need is something like this:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: functioning regex
replacement: ${1}:2222
where ${1} is the service IP and 2222 is the port I want.
Can anybody help me with that?
Thanks.
--
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 prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/19851a51-e137-49e3-8bab-8aa33cf04ff8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.