Relabel configs apply in the service discovery stage, once for each target – it looks like you have one instance, so you probably need `metric_relabel_configs`. Those are applied to the metric after scraping.
/MR On Thu, Jul 2, 2020, 12:00 'Владимир organ2' via Prometheus Users < [email protected]> wrote: > Hello. > I use vmware exporter. > For convenient notification management I want to add separate labels new > label "group_host" with name "critical_hosts" for all metrics which contain > label vm_name=host1 or host2. > > Here's some metrics form prometheus: > > vmware_vm_cpu_demand_average{cluster_name="Cluster",dc_name="Datacenter",host_name="esxi",instance=" > 10.10.10.10:9272",job="vmware hosts",tags="n/a",vm_name="host1"} > vmware_vm_cpu_demand_average{cluster_name="Cluster",dc_name="Datacenter",host_name="esxi",instance="10.10.10.10.:9272",job="vmware > hosts",tags="n/a",vm_name="host2"} > > vmware_vm_cpu_demand_average{cluster_name="Cluster",dc_name="Datacenter",host_name="esxi",instance=" > 10.10.10.10:9272",job="vmware hosts",tags="n/a",vm_name="host3"} > > vmware_vm_cpu_demand_average{cluster_name="Cluster",dc_name="Datacenter",host_name="esxi",instance=" > 10.10.10.10:9272",job="vmware hosts",tags="n/a",vm_name="host4"} > > > I wrote this relaballing but it doesn't work: > > relabel_configs: > - source_labels: [vm_name] > regex: host1|host2 > replacement: critical_hosts > target_label: group_host > action: replace > > -- > 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/9284dfa1-4779-4a64-b5b8-683c9ab2d163o%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/9284dfa1-4779-4a64-b5b8-683c9ab2d163o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAMV%3D_gaJCLpzZsa7SBOf_7D-aC31JUaH-H5Ci7BkFidhU2JTsA%40mail.gmail.com.

