My question is an addition to Prometheus dns service discovery in docker swarm.
I define the prometheus scrape targets as follows:
- job_name: 'node-exporter'
dns_sd_configs:
- names:
- 'tasks.nodeexporter'
type: 'A'
port: 9100
This works fine but results in prometheus using the IP of the docker container as instance label.
I tried to relabel the instance label as follows:
relabel_configs:
- source_labels: [__meta_dns_name]
target_label: instance
But doing so results in all instances of node-exporter having the same label "tasks.nodeexporter".
Is it somehow possible to relabel the instance label to something like tasks.nodexporter_1, tasks.nodeexporter_2, ...?