hi thanks it works!!! there is the possibility to mantain other label without using to match the target? only to filter in grafana?
thanks On Thursday, 21 May 2020 10:55:53 UTC+2, Julius Volz wrote: > > Hi, > > It sounds like you want a relabeling rule like: > > relabel_configs: > - action: replace > source_labels: [__meta_kubernetes_pod_container_name, > __meta_kubernetes_namespace, __meta_kubernetes_pod_container_port_number] > target_label: instance > regex: (.+);(.+);(\d+) > replacement: $1.$2:$3 > > (The source labels are concatenated with a ";" by default for the regex > match - you can control this character by setting "separator: ..." > explicitly in the relabeling rule) > > Be aware that the combination of pod container name, namespace, and port > number doesn't necessarily give you a unique instance identifier, as there > could be multiple pods with the same attributes. If you have multiple pods > of the same type, you probably want some distinguishing label like > "__meta_kubernetes_pod_name" or so in there. Most commonly, the labels that > identify a type of instance rather than a single specific instance / pod, > are put into the "job" label instead (with sometimes some dimensions like > namespace etc. broken out into separate labels as well). > > On Wed, May 20, 2020 at 11:04 PM cava cavamagie <[email protected] > <javascript:>> wrote: > >> HI >> i'm newbi >> can someone help me to write a relabeling to obtain >> >> >> targets: ['test-env.prometheus-dev:9095'] >> >> >> i think i have to use this but now why >> >> __meta_kubernetes_pod_container_name="test-env" >> __meta_kubernetes_namespace="prometheus-dev" >> __meta_kubernetes_pod_container_port_number="9095" >> >> >> many thanks for help >> >> Andrea >> >> >> ps can i add other custom label? >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/prometheus-users/aefcf756-f60f-4ac3-8720-36ddb0e5cb28%40googlegroups.com >> >> <https://groups.google.com/d/msgid/prometheus-users/aefcf756-f60f-4ac3-8720-36ddb0e5cb28%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Julius Volz > PromLabs - promlabs.com > -- 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/30475d01-2bd9-4895-8fa2-ae54d61fb3e7%40googlegroups.com.

