一千萬個為什麽

搜索

Sensu TCP連接問題



我在虛擬機上運行了一個新的sensu/uchiwa堆棧。這是一個“獨立”安裝 - redis,rabbitmq,sensu-server,sensu-api,sensu-client和uchiwa都安裝在同一臺機器上。我有一個client.json訂閱的單個支票。

總之,有些東西似乎是錯的。我登錄了uchiwa儀表板,並且出現一條警告消息“Datacenter sensu-81返回:500內部服務器錯誤”。

sensu-clientsensu-apisensu-server 日誌充滿了這些消息,只有這些消息:

==> /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是否按預期進行了配置,並且它是(默認情況下):

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

所以我檢查了sensu的rabbitmq.json,檢查它是否按預期配置,這又是一次。 (註意:我的主機文件中有一行將監視器轉換為127.0.0.1,我知道使用“localhost”導致IPv6問題的問題,因此我再次檢查hosts文件將“monitor”映射到127.0。 0.1)。為了進一步確認這些憑證正在運行,我打開rabbitmq基於Web的管理並使用這些憑證成功登錄。

{
  "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}]}
      ]}
].

如果我能提供更多細節,請告訴我。我無法繼續調試。

編輯1:

我還檢查了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
  }
}

Edit 2 Attempting to talk to the sensu api directly from inside the box gives a 500 error also:

[email protected]:/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 TCP連接問題

一共有 1 個回答:

結束rabbitmq日誌舉行的答案。我看到有些事情是錯的,但是這些信息太神秘了,我無法分辨真正的破壞。原來這是一個由舊版本的Erlang引起的SSL問題,這是默認安裝在ubuntu 14.04(erlang版本R16B03)上的原因。

這個問題是我指出解決方案的問題:

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

I needed to upgrade to Erlang >= 17.5, then it worked as expected.