title: Right way to access cadvisor in a swarm environment
body: <p>I have a Swarm with two nodes and I am running cadvisor as a global service. I get metrics and grafana/Promethues can scrape them. However my numbers are wrong. When I check the number of containers with the docker command line tools I see that there are 17 containers running on the first node and 14 containers on the second node. Prometheus/grafana however will tell me that I got 34 containers and the number of containers is 17 on both nodes.</p>
  
  <p>I assume my problems comes from having cadvisor defined in a different stack than the prometheus and grafana container and trying to access cadvisor via the service API.</p>
  
  <p>In stack A I have</p>
  
  <pre><code>version: '3.6'
  
  services:
  
    cadvisor:
      image: google/cadvisor
      deploy:
        mode: global
      ports:
        - "8888:8080"
      #privileged: true 
      #command: 
      volumes:
        - /:/rootfs:ro
        - /var/run:/var/run:rw
        - /sys:/sys:ro
        - /var/lib/docker/:/var/lib/docker:ro    
  </code></pre>
  
  <p>Then in the prometheus.yml configuration I have the following scrape definition, where host1 and host2 are the host names of the nodes.</p>
  
  <pre><code>  - job_name: 'cadvisor'
      scrape_interval: 20s
      static_configs:
        - targets: ['host1:8888','host2:8888']  
  </code></pre>
  
  <p>Has someone a working example for using cadvisor in a swarm with more the one node or can point out how to define the targets for cadvisor in the proemtheus configuration?</p>