I'm trying to scrape metrics from my ec2 machines. Those machines has a complex name due to Auto scaling group. For example:
ProjectName/project-name-dev-cluster/project-name-dev-LaunchTemplate
ProjectName/project-name-prod-cluster/project-name-prod-LaunchTemplate
ProjectName/project-name-prod-cluster/project-name-prod-LaunchTemplate
Beyond their name, I need to relabel the names in the relabel_configs section in the prometheus.yaml
: I need to rename those machines to look something like this: project_name-environment-counter
so, for example:
project_name-dev-1
project_name-prod-1
project_name-prod-2
so basically I need to count how many dev and prod machines are. I've tried something but noting worked.
Any suggestions?