官术网_书友最值得收藏!

  • The DevOps 2.2 Toolkit
  • Viktor Farcic
  • 282字
  • 2021-06-24 18:46:22

Deploying Docker Flow Monitor

Deploying Docker Flow Monitor is easy (as almost all Docker services are). We'll start by creating a network called monitor. We could let Docker stack create it for us, but it is useful to have it defined externally so that we can easily attach it to services from other stacks:

docker network create -d overlay monitor  

The stack is as follows:

version: "3" 
services: 
  monitor: 
    image: vfarcic/docker-flow-monitor:${TAG:-latest} 
    environment: 
      - GLOBAL_SCRAPE_INTERVAL=10s 
    networks: 
      - monitor 
    ports: 
      - 9090:9090 
networks: 
    monitor: 
       external: true 

The environment variable GLOBAL_SCRAPE_INTERVAL shows the first improvement over the "original" Prometheus service. It allows us to define entries of its configuration as environment variables. That, in itself, is not a significant improvement but is a good start. More powerful additions will be explored later on.

Please visit environment variables section of the documentation for more information about configuration options at (http://monitor.dockerflow.com/config/#environment-variables).

Now we're ready to deploy the stack:

docker stack rm monitor
    
docker stack deploy \
    -c stacks/docker-flow-monitor.yml \
    monitor

Please wait a few moments until Swarm pulls the image and starts the service. You can monitor the status by executing docker stack ps monitor command.

Once the service is running, we can confirm that the environment variable indeed generated the configuration:

open "http://$(docker-machine ip swarm-1):9090/config"
Figure 3-6: Prometheus configuration defined through environment variables
Please note that you do not have to use Docker Flow Monitor to accomplish the same Prometheus configuration. We are using it mostly as a fast and dynamic way to configure it. You can choose to do the same by changing its configuration manually.

We are going to expose services url in pretty format, therefore we must get rid of port number (9090) in preceding url.

主站蜘蛛池模板: 安徽省| 沭阳县| 腾冲县| 洪江市| 阿克陶县| 新乐市| 辽宁省| 屏东县| 嘉义县| 皮山县| 日土县| 长沙市| 宣化县| 延安市| 颍上县| 兴安县| 安吉县| 嵩明县| 乐业县| 桃园县| 浮山县| 镇平县| 兰州市| 武平县| 古浪县| 临澧县| 剑阁县| 恩施市| 蓬莱市| 苏尼特右旗| 永春县| 贡山| 永胜县| 如东县| 石嘴山市| 昌宁县| 固阳县| 巴东县| 中牟县| 西乌| 墨玉县|