Rabbitmq

為什麼 Uchiwa 中看不到遠端 Sensu Client?

  • August 15, 2016

我在 Centos 6.5 機器上設置了 sensu,並在 sensu 機器上安裝/配置了客戶端,所以它像這樣監控自己

/etc/sensu/conf.d/client.json

{
 "client": {
   "name": "sensu",
   "address": "10.100.1.200",
   "subscriptions": [
     "ALL"
   ]
 }
}

這工作正常,它顯示在 Uchiwa 中,但現在我有另一個主機我想在 Sensu/Uchiwa 註冊,它沒有出現在 Uchiwa/Sensu 下的客戶端中

這是客戶端“咖啡”上的配置

/etc/sensu/conf.d/rabbitmq.json

{
"rabbitmq":{
 "host": "10.100.1.200",
 "port": "5672",
 "vhost": "/sensu",
 "user": "user",
 "pass": "pass"
}
}

/etc/sensu/conf.d/client.json

{
 "client": {
   "name": "coffee",
   "address": "10.100.1.19",
   "subscriptions": [
     "ALL"
   ]
 }
}

當我在咖啡上跟踪 /var/log/sensu/sensu-client.log 時,我看到以下內容:

{"timestamp":"2015-07-13T07:15:52.856009-0500","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/client.json"}
{"timestamp":"2015-07-13T07:15:52.856157-0500","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/client.json","changes":{"client":{"subscriptions":[["ALL","ALL"],["ALL"]]}}}
{"timestamp":"2015-07-13T07:15:52.856235-0500","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/rabbitmq.json"}
{"timestamp":"2015-07-13T07:15:52.856330-0500","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/rabbitmq.json","changes":{"rabbitmq":{"port":[5672,"5672"],"pass":"REDACTED"}}}
{"timestamp":"2015-07-13T07:15:52.859696-0500","level":"warn","message":"loading extension files from directory","directory":"/etc/sensu/extensions"}
{"timestamp":"2015-07-13T07:15:53.051176-0500","level":"warn","message":"reconnecting to transport"}

看起來它正在與 RabbitMQ 交談,但由於某種原因,客戶端沒有出現在 Uchiwa 中。我怎樣才能進一步深入研究並弄清楚發生了什麼並讓咖啡服務員註冊?

該問題是由 和 之間的顯著時間差引起sensu-clientsensu-server

user@sensu-server:~# date
Mon Aug 15 06:17:37 UTC 2016

對比

user@sensu-client:~$ date
ma aug 15 08:17:37 CEST 2016

解決方案

通過使用以下方式同步時鐘解決了該問題timedatectl

user@sensu-server:~# sudo timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
...

並通過發出以下命令更改時區:

user@sensu-server:~# sudo timedatectl set-timezone Europe/Amsterdam

將伺服器上的時間與客戶端同步:

user@sensu-server:~# date
Mon Aug 15 08:25:14 UTC 2016

重啟後sensu-services發現rabbitmq客戶端sensu-api在Uchiwa中註冊。

引用自:https://serverfault.com/questions/705339