Spring boot Prometheus Monitor Docker Swarm(负载平衡)端点收件箱x

Spring boot Prometheus Monitor Docker Swarm(负载平衡)端点收件箱x,spring-boot,monitoring,docker-swarm,prometheus,Spring Boot,Monitoring,Docker Swarm,Prometheus,我能够设置Prometheus和Grafana来监视我的一个SpringBootAPI。当我们在给定的目标端点中有一个实例/副本时,这就可以正常工作了 scrape_configs: - job_name: 'prometheus' metrics_path: '/prometheus' static_configs: - targets: ['api.springboot.myhost.com:8080'] 然而,在我们的企业环境中,我们将Springbo

我能够设置Prometheus和Grafana来监视我的一个SpringBootAPI。当我们在给定的目标端点中有一个实例/副本时,这就可以正常工作了

scrape_configs:
  - job_name: 'prometheus'

    metrics_path: '/prometheus'

    static_configs:
      - targets: ['api.springboot.myhost.com:8080']
然而,在我们的企业环境中,我们将Springboot应用程序作为Docker Swarm服务运行。docker服务只有一个端点,但在一个服务下有多个应用程序实例/副本。 我们如何配置prometheus来监视所有副本,因为它们只有一个端点

scrape_configs:
  - job_name: 'prometheus'

    metrics_path: '/prometheus'

    static_configs:
      - targets: ['api.springboot.myhost.com:8080']
如果我概括一下,Prometheus如何监视负载平衡端点的所有实例

scrape_configs:
  - job_name: 'prometheus'

    metrics_path: '/prometheus'

    static_configs:
      - targets: ['api.springboot.myhost.com:8080']

您需要将Prometheus配置为刮取所有实例,而不是通过负载平衡器刮取复制作业

因为Swarm还没有API允许您通过网络发现其服务,所以最好的方法是使用类似+