Skip to content

Commit

Permalink
Merge pull request #15 from alonsodomin/master
Browse files Browse the repository at this point in the history
Support services using 'awsvpc' network mode.
  • Loading branch information
chicofranchico authored Aug 10, 2018
2 parents 5eadad6 + 7f7d266 commit 17833bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down Expand Up @@ -188,7 +189,7 @@ func (t *AugmentedTask) ExporterInformation() []*PrometheusTaskInfo {
continue
}

if *t.LaunchType != "FARGATE" {
if len(i.NetworkBindings) > 0 {
for _, nb := range i.NetworkBindings {
if int(*nb.ContainerPort) == exporterPort {
hostPort = *nb.HostPort
Expand All @@ -203,7 +204,6 @@ func (t *AugmentedTask) ExporterInformation() []*PrometheusTaskInfo {
hostPort = int64(exporterPort)
}


if exporterServerName, ok = d.DockerLabels["PROMETHEUS_EXPORTER_SERVER_NAME"]; ok {
host = strings.TrimRight(*exporterServerName, "/")
} else {
Expand Down Expand Up @@ -509,9 +509,14 @@ func GetAugmentedTasks(svc *ecs.ECS, svcec2 *ec2.EC2, clusterArns []*string) ([]

func main() {
flag.Parse()
sess := session.New()

config := aws.NewConfig().WithCredentialsChainVerboseErrors(true)

// Initialise AWS Service clients
sess := session.New(config)
svc := ecs.New(sess)
svcec2 := ec2.New(sess)

work := func() {
clusters, err := GetClusters(svc)
if err != nil {
Expand Down

0 comments on commit 17833bc

Please sign in to comment.