On 16/11/2020 21:12, Carlos Colaço wrote:

Prometheus is using port 80 instead of 8080 when using service discovery to get Cadvisor containers.

Config:

```
  # Create a job for Docker Swarm containers.
  - job_name: 'dockerswarm'
    dockerswarm_sd_configs:
      - host: unix:///var/run/docker.sock
        role: tasks
    relabel_configs:
      - source_labels: [__meta_dockerswarm_service_mode]
        regex: global
        action: keep
      - source_labels: [__meta_dockerswarm_task_desired_state]
        regex: running
        action: keep
      - source_labels: [__meta_dockerswarm_node_hostname]
        target_label: job
```


As per the documentation at https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dockerswarm_sd_config when you use the role: tasks it will return targets using the published ports. If there are none it will use the job's "port" value, which defaults to 80.

Therefore it suggests that you don't have a published port for that container.

To make it work you could publish port 8080, or you could adjust your relabling to change the port being used (by adjusting __address__) possibly by having a label on the task.


--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/b116cece-7523-17b8-c99e-5204ef9033f9%40Jahingo.com.

Reply via email to