这篇文章与使用 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