英文:
Connect celery-flower and prometheus in separate docker-compose files
问题
我想连接 celery-flower
和 prometheus
。我按照这个指南进行操作 - https://github.com/mher/flower/blob/master/docs/prometheus-integration.rst
我有两个 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
observability/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
observability/prometheus.yml
scrape_configs:
- job_name: flower
static_configs:
- targets:
- celery-flower:5555
但是我在 http://localhost:9090/graph 上看不到 celery-flower。
这两个容器都能够看到 flower
网络(通过 docker inspect
)。
从 prometheus
容器 ping
PING celery-flower (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 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.072/0.098/0.122 ms
连接
telnet celery-flower 5555
Connected to celery-flower
英文:
I want to connect celery-flower
and prometheus
. I work following this instruction - https://github.com/mher/flower/blob/master/docs/prometheus-integration.rst
I have 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
observability/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
observability/prometheus.yml
scrape_configs:
- job_name: flower
static_configs:
- targets:
- celery-flower:5555
But i don't see celery-flower on the http://localhost:9090/graph
Both containers see the flower
network (via docker inspect
)
Ping from prometheus
container
PING celery-flower (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 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 0.072/0.098/0.122 ms
Connection
telnet celery-flower 5555
Connected to celery-flower
答案1
得分: 0
不正确的celery-flower
运行命令(需要删除--url_prefix=flower
)
app/docker-compose.yml
celery-flower:
restart: always
image: mher/flower:1.2.0
container_name: celery-flower
command: celery flower -l INFO --persisten=True
volumes:
- flower_data:/data
environment:
- CELERY_BROKER_URL=redis://redis:6379
ports:
- 5555:5555
networks:
- default
- flower
英文:
Incorrect command for celery-flower
running (need to remove --url_prefix=flower
)
app/docker-compose.yml
celery-flower:
restart: always
image: mher/flower:1.2.0
container_name: celery-flower
command: celery flower -l INFO --persisten=True
volumes:
- flower_data:/data
environment:
- CELERY_BROKER_URL=redis://redis:6379
ports:
- 5555:5555
networks:
- default
- flower
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论