我在虚拟机上运行了一个新的sensu / uchiwa堆栈。它是“独立”安装-Redis,rabbitmq,sensu-server,sensu-api,sensu-client和uchiwa都安装在同一台计算机上。我只检查了client.json所订阅的一项。

简而言之,似乎有些问题。我登录了uchiwa仪表板,并显示一条警告消息“ Datacenter sensu-81返回:500内部服务器错误”。消息:

==> /var/log/sensu/sensu-api.log <==
{"timestamp":"2017-05-11T21:00:34.758243+0000","level":"warn","message":"transport connection error","reason":"tcp connection lost"}
{"timestamp":"2017-05-11T21:00:34.758784+0000","level":"warn","message":"transport connection error","reason":"possible authentication failure. wrong credentials?","user":"sensu"}

==> /var/log/sensu/sensu-client.log <==
{"timestamp":"2017-05-11T21:00:35.973060+0000","level":"warn","message":"transport connection error","reason":"tcp connection lost"}
{"timestamp":"2017-05-11T21:00:35.974858+0000","level":"warn","message":"transport connection error","reason":"possible authentication failure. wrong credentials?","user":"sensu"}

==> /var/log/sensu/sensu-server.log <==
{"timestamp":"2017-05-11T21:00:37.489540+0000","level":"warn","message":"transport connection error","reason":"tcp connection lost"}
{"timestamp":"2017-05-11T21:00:37.489704+0000","level":"warn","message":"transport connection error","reason":"possible authentication failure. wrong credentials?","user":"sensu"}


它表明连接到传输层时出错,所以我检查了是否正确配置了transport.json,并且( sensu默认):

{
  "transport": {
    "name": "rabbitmq",
    "reconnect_on_error": true
  }
}


所以我检查了sensu的rabbitmq.json,以检查它的配置是否与预期的一样。 (注意:我的主机文件中有一行,它将监视器转换为127.0.0.1。我知道使用“ localhost”会导致IPv6问题的问题,因此我再次检查了主机文件是否将“监视器”映射到127.0。 0.1)。为了进一步确认这些凭据是否有效,我打开了基于Web的Rabbitmq管理并使用这些凭据成功登录。

{
  "rabbitmq": {
        "ssl": {
      "cert_chain_file": "/etc/sensu/ssl/cert.pem",
      "private_key_file": "/etc/sensu/ssl/key.pem"
    },
        "host": "monitor",
    "port": 5671,
    "vhost": "/sensu",
    "user": "sensu",
    "password": "sensu"
  }
}


我还检查了以下配置: Rabbitmq本身符合预期(打开了ssl等):

[
    {rabbit, [
        {ssl_listeners, [5671]},
    {ssl_options, [{cacertfile,"/etc/rabbitmq/ssl/cacert.pem"},
                   {certfile,"/etc/rabbitmq/ssl/cert.pem"},
                   {keyfile,"/etc/rabbitmq/ssl/key.pem"},
                   {verify,verify_peer},
                   {fail_if_no_peer_cert,true}]}
      ]}
].


我不知所措,可以继续进行调试。

我还检查了api.json和uchiwa.json配置文件,只是为了确保它们具有匹配的凭据,它们可以做到:

api.json:

{
  "api": {
    "host": "monitor",
    "port": 4567,
    "user": "admin",
    "password": "secret"
  }
}


uchiwa.json:

{
 "sensu": [
   {
       "name": "",
       "host": "monitor",
       "ssl": false,
       "port": 4567,
       "user": "admin",
       "pass": "secret",
       "path": "",
       "timeout": 5000
   }
 ],
 "uchiwa": {
   "users": [
    {
        "password": "admin",
        "username": "admin"
    }
],
   "port": 3000,
   "refresh": 5
  }
}


尝试直接从盒子内部与sensu api交谈也会产生500错误:

vagrant@vagrant-ubuntu-trusty-64:/etc/default$ curl -I http://localhost:4567/stashes -u admin
Enter host password for user 'admin':
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Connection: close
Content-length: 0


评论

我在Sensu上遇到了类似的问题,而问题却变得微不足道-我在sensu配置中指定的RabbitMQ用户没有操作所需的权限。

#1 楼

最终,rabbitmq日志保存了答案。我看到有什么问题,但是消息太神秘了,我无法分辨是什么在破坏。原来这是由旧版本的Erlang引起的SSL问题,该问题是apt默认在ubuntu 14.04(erlang版本R16B03)上安装的。 :

https://github.com/squaremo/amqp.node/issues/224

我需要升级到Erlang> = 17.5,然后按预期工作。

评论


很高兴看到您自己解决了问题,并希望与以后的读者分享它:)

–滕西拜
17年5月12日在10:34