0

我正在对接 sensu 基础设施。除了执行检查外,一切都很好。

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

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 和 sensu-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 服务器认为没有要运行的检查。虽然,我不知道为什么会这样。

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

4

1 回答 1

0

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

于 2016-05-01T04:02:48.507 回答