Hello all,
I've managed to get prometheus to collect metrics from Traefik. However, it seems to only see traffic from its own entry point which happens to be the web-secure one!
I'm experiencing similar issue only the other way around. I do obtain metrics for internal services and for what's defined within the file provider while docker provider metrics are not recognized or included. Dashboard shows everything as it should. I've seen that if I swap the entrypoint with one of the others, I do obtain then that missing entrypoint within data but without any related routers our services. Any good suggestion on why this would be happening? I've seen "out there" that some do define metrics within the docker provider but for my setup I've followed the official docs (yaml + manual routing within dyn. conf.). Any suggestions really appreciated.
Just a followup... I've moved metrics section within the static config file to the bottom (end) so that metrics are being loaded last. Previously I've had metrics defined before both provider files. Now I'm missing only one entry point that has permanent redirection to another so I guess that should be ok... if it helps anyone...
Any updates on this? I'm deploying with swarm, and providing static config via CLI flags to the service container command, and dynamic config via labels. I'm not seeing anytraefik_service* labels at all, but can see all other types, e.g. traefik_entrypoint*
I'm using a dedicated metrics entrypoint, but I also tried exposing them on my main web entrypoint, where are my services are exposed, and got the same result.
compose.yml
traefik:
networks:
- triviaties_production_network
logging: *default-logging
image: traefik:2.11
volumes:
- triviaties_production_traefik:/etc/traefik/acme
- /var/run/docker.sock:/var/run/docker.sock:ro
# this may eventually be used if we use Traefik's offical documented Swarm endpoint instead
# of bind mounting the docker socket
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '0.0.0.0:80:80'
- '0.0.0.0:443:443'
# metrics
- '0.0.0.0:8082:8082'
command: >
--log.level=INFO
--accesslog=true
--providers.docker.watch=true
--providers.docker=true
--providers.docker.swarmMode=true
--providers.docker.exposedByDefault=false
--entrypoints.metrics.address=:8082
--entrypoints.web.address=:80
--entrypoints.web.http.redirections.entrypoint.to=web-secure
--entrypoints.web-secure.address=:443
--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=route53
--certificatesresolvers.letsencrypt.acme.email=redact
--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme.json
--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
--api=true
--api.dashboard=true
--metrics=true
--metrics.prometheus=true
--metrics.prometheus.addEntryPointsLabels=true
--metrics.prometheus.addRoutersLabels=true
--metrics.prometheus.addServicesLabels=true
--metrics.prometheus.entryPoint=metrics
deploy:
labels:
- 'traefik.enable=true'
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager