在单独的 docker-compose 文件中连接 celery-flower 和 prometheus

问题描述 投票:0回答:0

我想连接celery-flowerprometheus。我按照这个指令工作 - https://github.com/mher/flower/blob/master/docs/prometheus-integration.rst

我有2个docker-compose.yml.

app/docker-compose.yml

  celery-flower:
    ...
    container_name: celery-flower
    command: celery -A configs flower -l INFO --url_prefix=flower --port=5555 --persisten=True
    ports:
      - "5555:5555"
    networks:
      - default
      - flower

networks:
  default:
  flower:
    external: true

可观察性/docker-compose.yml

  prometheus:
    ...
    volumes:
      - $PWD/prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/etc/prometheus/console_libraries'
      - '--web.console.templates=/etc/prometheus/consoles'
      - '--web.enable-lifecycle'
    expose:
      - 9090
    ports:
       - 9090:9090
    networks:
      - observability
      - flower

networks:
  observability:
  flower:
    external: true

可观察性/prometheus.yml

scrape_configs:
- job_name: flower
  static_configs:
  - targets:
    - celery-flower:5555

但是我在 http://localhost:9090/graph 上没有看到 celery-flower

两个容器都看到 flower 网络(通过 docker inspect

Ping 来自 prometheus 容器

PING celery-flower:5555 (172.21.0.3): 56 data bytes
64 bytes from 172.21.0.3: seq=0 ttl=64 time=0.122 ms
64 bytes from 172.21.0.3: seq=1 ttl=64 time=0.113 ms
64 bytes from 172.21.0.3: seq=2 ttl=64 time=0.116 ms
64 bytes from 172.21.0.3: seq=3 ttl=64 time=0.093 ms
64 bytes from 172.21.0.3: seq=4 ttl=64 time=0.072 ms
64 bytes from 172.21.0.3: seq=5 ttl=64 time=0.076 ms
--- celery-flower:5555 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.072/0.098/0.122 ms
docker-compose celery prometheus docker-networking flower
© www.soinside.com 2019 - 2024. All rights reserved.