Thank you @Julien and @Stuart.
By default the Docker daemon is running on the socket, and can only
retrieve the metrics from the current Docker daemon.
On the other Docker Swarm manager node, setup the Daemon docker using
http/https and it should solve the problem.
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://<ip_address_of_the_node>:2376
Make sure the port is available!
That was using the solution, defining a new job in the prometheus.yml
configuration file:
- job_name: 'test-nodes-clusterB'
dockerswarm_sd_configs:
- host: tcp://<ip_address>:2376
role: nodes
relabel_configs:
# Fetch metrics on port 9323.
- source_labels: [__meta_dockerswarm_node_address]
target_label: __address__
replacement: $1:9323
# Set hostname as instance label
- source_labels: [__meta_dockerswarm_node_hostname]
target_label: instance
On Friday, 31 July 2020 11:33:34 UTC+2, Stuart Clark wrote:
>
> On 2020-07-31 10:30, Julien Pivotto wrote:
> > You can specify another cluster with https?
> >
> > I am also wondering if
> > a host specified with ssh://example.com could work?
> > (https://docs.docker.com/engine/reference/commandline/dockerd/)
>
> Can't you use the tcp:// port rather than the socket?
>
> >
> > On 31 Jul 02:20, Tom Kun wrote:
> >> Because it does the job for the cluster where Prom is embedded but not
> >> for
> >> the others...
> >>
> >> On Friday, 31 July 2020 11:18:08 UTC+2, Julien Pivotto wrote:
> >> >
> >> > Why don't you use the new Docker Swarm configuration?
> >> >
> >> > https://prometheus.io/docs/guides/dockerswarm/
> >> >
> >> > On 31 Jul 02:09, Tom Kun wrote:
> >> > > I try to use the static_configs but I encountered issues about
> settings
> >> > > node_id and node_name.
> >> > > Al my targets get the node_name and node_id.
> >> > >
> >> > > This is the entrypoint.sh I use to set the node_name and the
> node_id for
> >> > > each node_exporter hosts:
> >> > > #!/bin/sh -e
> >> > >
> >> > > NODE_CLUSTER=$(cat /etc/node_cluster)
> >> > > NODE_NAME=$(cat /etc/nodename)
> >> > >
> >> > > echo "node_meta{node_id=\"$NODE_ID\",
> >> > > container_label_com_docker_swarm_node_id=\"$NODE_ID\",
> >> > > node_name=\"$NODE_NAME\", node_cluster=\"${NODE_CLUSTER}\"} 1" >
> >> > > /etc/node-exporter/node-meta.prom
> >> > >
> >> > > set -- /bin/node_exporter "$@"
> >> > > exec "$@"
> >> > >
> >> > >
> >> > > So I don't think that static_configs is the solution at this actual
> >> > issue...
> >> > >
> >> > > Do I have to install Prometheus on each of my cluster manager to
> >> > retrieve
> >> > > the different metrics?
> >> > > It's not possible to give to the Prometheus metrics from different
> Swarm
> >> > > clusters?
> >> > >
> >> > > On Thursday, 30 July 2020 09:34:37 UTC+2, Brian Candler wrote:
> >> > > >
> >> > > > Just as an aside: it would be better use static_sd_configs or
> >> > > > file_sd_configs in the case where you list all the nodes
> explicitly.
> >> > > >
> >> > > > dns_sd_configs is intended for when you do a single query, and
> the
> >> > > > response contains a set of A or AAAA records representing all the
> >> > targets.
> >> > > >
> >> > >
> >> > > --
> >> > > 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] <javascript:>.
> >> > > To view this discussion on the web visit
> >> >
> https://groups.google.com/d/msgid/prometheus-users/ba815e7c-124c-424f-9a53-51c2c1df573co%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] <javascript:>.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/prometheus-users/97dee187-56bf-4f01-a4e1-308e09cf706bo%40googlegroups.com.
>
>
> >
> >
> > --
> > Julien Pivotto
> > @roidelapluie
>
> --
> Stuart Clark
>
--
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/56a0f0ba-291e-4c3d-8ee0-17471cc0c771o%40googlegroups.com.