Spaced-Out / ecs-container-exporter

AWS ECS side car that exports ECS container level docker stats metrics to Prometheus as well as publish it via Statsd.
MIT License
26 stars 3 forks source link

Fargate metrics #2

Closed hossein-rasi closed 3 years ago

hossein-rasi commented 3 years ago

Hello. I am trying to get docker stats metrics from fargate containers using this ecs-container-exporter. What I am doing is to add ecs-container-exporter container in the same task-definition that the fargate container is running. I am also using the ecs-container-discovery to find the containers. In prometheus, I can see in target section that the ecs container is there but the state is DOWN. So now my questions are:

  1. Is the metric endpoint path for ecs-container-exporter only /metrics or do I need to use customer path for that?
  2. Do I need to add the DockerLables ("PROMETHEUS_EXPORTER_PORT": "9545") also to the fargate containers that I want to see docker stats metric or it only needs to be added into ecs-exporter container?

In my scenario also the ecs-exporter is running as fargate. My task-definition json file is:

[
  {
    "Name": "name",
    "Image": "something",
    "Essential": true,
    "MemoryReservation": 1200,
    "cpu": 800,
    "PortMappings": [],
    "HealthCheck": {},
    "logConfiguration": {}
    },
    "DockerLabels": {
      "PROMETHEUS_EXPORTER_PORT": "9545"
    }
  },
  {
    "Name": "ecs-exporter",
    "Image": "raags/ecs-container-exporter:latest",
    "Essential": true,
    "MemoryReservation": 260,
    "cpu": 100,
    "DockerLabels": {
      "PROMETHEUS_EXPORTER_PORT": "9545"
    },
    "PortMappings": [
      {
        "protocol": "tcp",
        "ContainerPort": 9545
      }
    ],
    "logConfiguration": {}
    }
  }
]

Thanks

raags commented 3 years ago

In prometheus, I can see in target section that the ecs container is there but the state is DOWN.

Is the port 9545 reachable from the Prometheus instance? You can use nc to verify this.

So now my questions are:

  1. Is the metric endpoint path for ecs-container-exporter only /metrics or do I need to use customer path for that?

Its the standard path, so no changes are required

  1. Do I need to add the DockerLables ("PROMETHEUS_EXPORTER_PORT": "9545") also to the fargate containers that I want to see docker stats metric or it only needs to be added into ecs-exporter container?

No, only the exporter needs the label. This is how the prometheus-ecs-discovery SD works.