The labels in the SD file can only be provided for each target group (the top-level list item type of the YAML file), so you'd have to do something like this:
- targets: - [...first list of targets...] labels: instance: "A" - targets: - [...second list of targets...] labels: instance: "B" - targets: - [...third list of targets...] labels: instance: "C" On Tue, Apr 18, 2023 at 11:20 AM Kolja Krückmann <kolja.krueckm...@opheo.com> wrote: > Hi y'all I'm trying to get a label for each target in my file_sd_config > > my prom.yml is: > (redacted) > > # my global config > global: > scrape_interval: 1m # Set the scrape interval to every 15 seconds. > Default is every 1 minute. > evaluation_interval: 30s # Evaluate rules every 15 seconds. The default > is every 1 minute. > scrape_timeout: 30s > > scrape_configs: > # The job name is added as a label `job=<job_name>` to any timeseries > scraped from this config. > - job_name: 'node' > file_sd_configs: > - files: > - > C:/Prometheus/prometheus-2.41.0.windows-amd64/target_cluster_b.yml > > my target_cluster_b.yml: > - targets: > - 172.25.X0.XXX:9182 > labels: > instance: "SVR-DS01" > - 172.21.X1.XXX:9182 > - 172.25.X2.XXX:9182 > - 172.25.X3.XXX:9182 > > as seen in the target.yml I want to try to get a label to each target - to > see in the prom dashboard which ip is which targetname > > Thanks in advance. > Kind regards Kolja > > -- > 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-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/fa4e5c9e-807b-4680-9640-592c8172e568n%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/fa4e5c9e-807b-4680-9640-592c8172e568n%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 prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAObpH5z%2B%3DMLjoJ65Low1n5WyfA31iCJS8v3Og%3DYaodPh03mj6A%40mail.gmail.com.