无法在docker-compose上下文

时间:2015-11-26 14:49:15

标签: docker-compose sensu

我对感知基础设施进行了码头化。除了执行支票外,一切都很顺利。

我根据这个结构使用docker-compose(docker-compose.yml):

sensu-core:
    build: sensu-core/
    links:
            - redis
            - rabbitmq
sensors-production:
    build: sensors-production/
    links:
            - rabbitmq
uchiwa:
    build: sensu-uchiwa
    links:
            - sensu-core
    ports:
            - "3000:3000"
rabbitmq:
    build: rabbitmq/
redis:
    image: redis
    command: redis-server

我的rabbitmq Dockerfile非常简单:

FROM ubuntu:latest

RUN apt-get -y install wget
RUN wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
RUN dpkg -i erlang-solutions_1.0_all.deb

RUN wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
RUN apt-key add rabbitmq-signing-key-public.asc
RUN echo "deb     http://www.rabbitmq.com/debian/ testing main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

RUN apt-get update
RUN apt-get -y install erlang rabbitmq-server

CMD /etc/init.d/rabbitmq-server start && \
    rabbitmqctl add_vhost /sensu && \
    rabbitmqctl add_user sensu secret && \
    rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*" && \
    cd /var/log/rabbitmq/ && \
    ls -1 * | xargs tail -f

uchiwa Dockerfile也是如此:

FROM podbox/sensu

RUN apt-get -y install uchiwa

RUN echo ' \
{ \
  "sensu": [ \
    { \
      "name": "Sensu", \
      "host": "sensu-core", \
      "port": 4567, \
      "timeout": 5 \
    } \
  ], \
  "uchiwa": { \
    "host": "0.0.0.0", \
    "port": 3000, \
    "interval": 5 \
  } \
}' > /etc/sensu/uchiwa.json

EXPOSE 3000

CMD /etc/init.d/uchiwa start && \
    tail -f /var/log/uchiwa.log

Sensu核心运行sensu-server&意义上的API。这是他的dockerfile:

FROM podbox/sensu

RUN apt-get -y install sensu

RUN echo '{ \
  "rabbitmq": { \
    "host": "rabbitmq", \
    "vhost": "/sensu", \
    "user": "sensu", \
    "password": "secret" \
  }, \
  "redis": { \
    "host": "redis", \
    "port": 6379 \
  }, \
  "api": { \
    "host": "localhost", \
    "port": 4567 \
  } \
}' >> /etc/sensu/config.json

CMD /etc/init.d/sensu-server start && \
    /etc/init.d/sensu-api start && \
    tail -f /var/log/sensu/sensu-server.log -f /var/log/sensu-api.log

传感器 - 生产运行sensu-client以及一个愚蠢的指标,这是他的Dockerfile:

FROM podbox/sensu

RUN apt-get -y install sensu

RUN echo '{ \
  "rabbitmq": { \
    "host": "rabbitmq", \
    "vhost": "/sensu", \
    "user": "sensu", \
    "password": "secret" \
  } \
}' >> /etc/sensu/config.json
RUN mkdir -p /etc/sensu/conf.d
RUN echo '{ \
  "client": { \
    "name": "wise_oracle", \
    "address": "prod_sensors", \
    "subscriptions": [ \
      "web", "aws" \
    ] \
  } \
' >> /etc/sensu/conf.d/client.json

RUN echo '{ \
  "checks": { \
    "dumb": { \
      "command": "ls", \
      "subscribers": [ \
    "web" \
      ], \
      "interval": 10 \
    } \
  } \
}' >> /etc/sensu/conf.d/dumb.json

CMD /etc/init.d/sensu-client start && \
    tail -f /var/log/sensu/sensu-client.log

运行     docker-compose up -d 一切顺利。日志中没有错误,我可以访问uchiwa仪表板,它向我显示定义的客户端正常(keepalive请求似乎没问题)。但是,没有检查。

我注意到日志中没有检查请求/检查结果,就好像sensu服务器认为没有检查要运行一样。虽然,我不知道为什么会这样。

有人可以更准确地告诉我发生了什么吗?谢谢。

1 个答案:

答案 0 :(得分:0)

检查请求/结果将通过RabbitMQ传送,您可以访问http://yourrabbitmqserver:15672以查看队列和订阅的消费者。 还要确保您的服务器在/sensu/conf.d中放置了一些check.json文件,以根据它们的间隔安排检查