我已经在 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"
]
}
}
当我在 coffee 上跟踪 /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 中。我该如何进一步深入研究并弄清楚发生了什么,并让咖啡服务器进行注册?
答案1
sensu-client
此问题是由于和之间的显著时差造成的sensu-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 中注册。