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

documentation miss: Docker label PROMETHEUS_EXPORTER_PORT should be defined in ECS Task definition #68

Closed muravjov closed 3 years ago

muravjov commented 3 years ago

First of all: thanks, it works.

But the documentation lacks information how to set docker label(s). I tried to to set up PROMETHEUS_EXPORTER_PORT in Dockerfile like

LABEL "PROMETHEUS_EXPORTER_PORT"="5000"

but still failed to write non-empty ecs_file_sd.yml . The log still featured

2021/06/12 04:00:51 Writing 0 discovered exporters to ecs_file_sd.yml

After poking with ECS services I managed to add

"dockerLabels": {
        "PROMETHEUS_EXPORTER_PORT": "5000"
      }

to the ECS task definition JSONs and it is what really fixed the issue.

I'm somewhat new to AWS ECS service stuff and maybe propagating real docker labels can be made, but current documentation is misleading, e.g. the words

To scrape the containers add following docker labels to them:
    PROMETHEUS_EXPORTER_PORT specify the container port where prometheus scrapes (mandatory)
chicofranchico commented 3 years ago

Hi, I don't see where this information is missing. If you think the documentation is lacking, just make a pull request and we can review it. Thanks!

muravjov commented 3 years ago

@chicofranchico done in PR #69 pls review

chicofranchico commented 3 years ago

That's much clearer indeed. Thanks for that.

gopkris2000 commented 1 year ago

@chicofranchico @muravjov I deployed the prometheus-ecs-discovery container in one of my AWS EC2 instance. It is running fine but getting the same "Writing 0 discovered exporters to /tmp/ecs_file_sd.yml" errors.

The confusion part is here, I tried to setup dockerLabels in my ECS task definition but showing a huge number of existing task definition in my AWS account and multiple cluster as well. Do I need to modify each task definition with the above dockerLabels config? or create a new one and again deploy the new container "prometheus-ecs-discovery"?

Please help me.

Rudd-O commented 1 year ago

Sorry but this is an issue tracker, not a support request forum. If it's getting no discovered exporters then there's probably a label matching issue.