teralytics / prometheus-ecs-discovery

A Prometheus discoverer that scrapes Amazon ECS and a generates file SD configuration file.
Apache License 2.0
260 stars 157 forks source link

prometheus-ecs-discovery not able to discover targets on EC2 with disabled DNS hostnames #63

Open zsaurabhsabharwal opened 3 years ago

zsaurabhsabharwal commented 3 years ago

On EC2 machines with DNS hostnames disabled, this check fails and as a result returns without processing that particular task.

This can be fixed by removing this check completely and instead extracting the IP address directly from EC2 instance description.

 ip = *t.EC2Instance.PrivateIpAddress
chicofranchico commented 3 years ago

What will happen if the instance has more than one private IP address? (also, could you update the code reference? I think it got messed up with latest merges)