I am trying to rename same labels from cadvisor in the prometheus config. The cadvisor names are just too long, so I have the following config for relabeling.
- job_name: 'cadvisor job foo'
scrape_interval: 60s
ec2_sd_configs:
- role_arn: 'arn:aws:iam::$id:role/foo'
region: 'us-west-2'
port: 8484
relabel_configs:
- source_labels: [__meta_container_label_com_amazonaws_ecs_cluster]
target_label: cluster_name
- source_labels: [__meta_container_label_com_amazonaws_ecs_container_name]
target_label: container_name
Unfortunately that does not seem to work. Is this even possible to relabel cadvisor labels in the prometheus config?
Are you sure that the label
__meta_container_label_com_amazonaws_ecs_cluster
exists? I'm running Cadvisor in a AWS ECS cluster and I get the container name fromcontainer_label_com_amazonaws_ecs_container_name
. It is not a meta label but extracted by Cadvisor from the Docker labels.__meta.+
labels are retrieved byrelabel_configs
. Here is what that part of my config looks like: