这篇文章与使用 YUM 安装 Sensu相结合,用于安装、配置和启动 Sensu 及相关服务:
sudo yum install -y erlang && \
sudo rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.0/rabbitmq-server-3.5.0-1.noarch.rpm && \
sudo yum install -y redis && \
echo '[sensu]
name=sensu
baseurl=http://sensu.global.ssl.fastly.net/yum/$basearch/
gpgcheck=0
enabled=1' | sudo tee /etc/yum.repos.d/sensu.repo && \
sudo yum install -y sensu && \
sudo yum install -y uchiwa && \
for s in rabbitmq-server redis.service sensu-server sensu-api uchiwa; do sudo systemctl restart $s; done && \
sudo rabbitmqctl add_vhost /sensu && \
sudo rabbitmqctl add_user sensu secret && \
sudo rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"
分析
- 导航到 :3000 显示 uchiwa 仪表板并指示
Connection error. Is the Sensu API running?
- /var/log/sensu/sensu-api.log 表示
{"timestamp":"2016-07-03T22:58:58.532905+0000","level":"warn","message":"config file does not exist or is not readable","file":"/etc/sensu/config.json"}
{"timestamp":"2016-07-03T22:58:58.533069+0000","level":"warn","message":"ignoring config file","file":"/etc/sensu/config.json"}
{"timestamp":"2016-07-03T22:58:58.533137+0000","level":"warn","message":"loading config files from directory","directory":"/etc/sensu/conf.d"}
{"timestamp":"2016-07-03T22:58:58.712175+0000","level":"info","message":"api listening","protocol":"http","bind":"0.0.0.0","port":4567}
- config.json 似乎不存在(
/etc/sensu/config.json: No such file or directory
) - 下载示例 config.json并重新启动 sensu-api 并没有解决问题
{
"rabbitmq": {
"host": "localhost",
"vhost": "/sensu",
"user": "sensu",
"password": "secret"
},
"redis": {
"host": "localhost",
"port": 6379,
"password": "secret"
}
}
- redis端口正在监听:
LISTEN 0 128 127.0.0.1:6379 *:*
- rabbitmq 端口:
LISTEN 0 100 *:4567 *:*
- Uchiwa 无法连接到数据中心
{
"sensu": [
{
"name": "Site 1",
"host": "localhost",
"port": 4567,
"timeout": 10
},
{
"name": "Site 2",
"host": "localhost",
"port": 4567,
"ssl": false,
"path": "",
"user": "",
"pass": "",
"timeout": 10
}
],
"uchiwa": {
"host": "0.0.0.0",
"port": 3000,
"refresh": 10
}
}
{"timestamp":"2016-07-03T23:34:32.990067621Z","level":"warn","message":"GET http://localhost:4567/stashes returned: 500 Internal Server Error"}
{"timestamp":"2016-07-03T23:34:32.990102095Z","level":"warn","message":"Connection failed to the datacenter Site 1"}
{"timestamp":"2016-07-03T23:34:32.990115588Z","level":"info","message":"Updating the datacenter Site 2"}
{"timestamp":"2016-07-03T23:34:32.991462585Z","level":"warn","message":"GET http://localhost:4567/stashes returned: 500 Internal Server Error"}
{"timestamp":"2016-07-03T23:34:32.991492978Z","level":"warn","message":"Connection failed to the datacenter Site 2"}
- 导航到
<IPADDRESS>:4567
结果:
{"error":"redis and transport connections not initialized"}
- redis 回复
sudo redis-cli ping
PONG
- redis密码已设置,但问题仍然存在
sudo redis-cli
127.0.0.1:6379> auth secret
OK
当我在 rabbitmq.json 中设置正确的 SSL 配置时,我第一次让 RabbitMQ 工作,它在Sensu 网站上显示了一个示例。之后它只说:“错误”:“未连接到redis”
然后,我通过将 sensu 配置中的“localhost”更改为“127.0.0.1”来使 Redis 正常工作。由于 Redis 没有在 IPv6 上侦听,并且“localhost”同时解析了 ::1 和 127.0.0.1,因此无法正常工作。
这是 Debian 8 上的全新安装。
简洁的
sensu-client
似乎需要rabbitmq-server
运行. 由于此消息代理似乎没有运行,sensu-client
因此无法启动,Uchiwa 仪表板也无法对其进行监控。详细
如果出现以下错误:
显示并
redis
正在侦听,请检查它rabbitmq
是否正在运行并使用 rabbitmq-status 检查 rabbitmq 端口:例子
今天出现了上述错误,当检查 rabbitmq 端口时,似乎某个端口没有在监听:
配置 SSL 后,端口 5671 应配置为
/etc/rabbitmq.config
. 重新启动消息代理服务器后,ssl 端口5671
开始侦听并解决了问题:我的 rabbitmq 配置是:
验证 sensu-api 是否已配置并正在运行。在 centos-7.x
systemctl status sensu-api
上启动服务
systemctl start sensu-api