Skip to content

Commit

Permalink
handle disordered network interfaces (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhi-ag authored and Francisco de Freitas committed Dec 30, 2019
1 parent 44cac7d commit 8b048f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ func (t *AugmentedTask) ExporterInformation() []*PrometheusTaskInfo {
if len(t.EC2Instance.NetworkInterfaces) == 0 {
return ret
}

for _, iface := range t.EC2Instance.NetworkInterfaces {
if iface.PrivateIpAddress != nil && *iface.PrivateIpAddress != "" {
if iface.PrivateIpAddress != nil && *iface.PrivateIpAddress != "" &&
iface.PrivateDnsName != nil && *iface.PrivateDnsName != "" &&
*iface.PrivateDnsName == *t.EC2Instance.PrivateDnsName {
ip = *iface.PrivateIpAddress
break
}
Expand Down

0 comments on commit 8b048f6

Please sign in to comment.