Cool!
Missed that detail in the documentation, Thanks a lot ...
```
cadvisor:
image: gcr.io/google-containers/cadvisor
ports:
- target: 8080
published: 8080
protocol: tcp
mode: host
```
Working now!
On Monday, November 16, 2020 at 10:21:00 PM UTC+1 Julien Pivotto wrote:
> On 16 Nov 13:17, Carlos Colaço wrote:
> > can you please clarify?
>
> Is `--mode=global --publish target=8080,mode=host` in use within the
> cadvisor
> definition? Somehow you need to expose the port explicitly for
> prometheus.
>
>
>
> >
> > On Monday, November 16, 2020 at 10:16:21 PM UTC+1 Julien Pivotto wrote:
> >
> > > On 16 Nov 13: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
> > > > ```
> > >
> > > It is probably because cadvisor is probably not *explicitly* exposing
> a
> > > port. You
> > > will need more advance relabeling or setting port: to deal with this.
> > >
> > > >
> > > > Result:
> > > >
> > > > [image: swarm.png]
> > > >
> > > > cadvisor running on port 8080:
> > > >
> > > > ```
> > > > CONTAINER ID IMAGE
> > > > COMMAND CREATED STATUS
> > > > PORTS NAMES
> > > > fbac945d3422 gcr.io/google-containers/cadvisor:latest
> > > > "/usr/bin/cadvisor -…" 2 hours ago Up 2 hours (healthy)
> > > > 8080/tcp monitor_cadvisor.arwk
> > > > gx4tfipgvebitdx47wx4u.ur61fpo4824zn0znwt5s6ubmj
> > > > ```
> > > >
> > > > Even removing all relabel prometheus finds every task with correct
> port
> > > > except those ones using 8080 ...
> > > >
> > > > --
> > > > 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/289d83d2-0205-45b9-aa26-f0cafceb70e5n%40googlegroups.com
> > > .
> > >
> > >
> > >
> > > --
> > > Julien Pivotto
> > > @roidelapluie
> > >
> >
> > --
> > 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/d0f20ae0-dd2c-4597-a878-258f787adf1dn%40googlegroups.com
> .
>
>
> --
> Julien Pivotto
> @roidelapluie
>
--
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/ac2c5618-fbcf-4c4c-a58f-8d3a84aef90an%40googlegroups.com.