This post combined with Install Sensu using YUM was used in order to install, configure and start Sensu and related services:
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 ".*" ".*" ".*"
Analysis
- Navigating to :3000 shows the uchiwa dashboard and indicates
Connection error. Is the Sensu API running?
- /var/log/sensu/sensu-api.log indicates
{"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}
- The config.json does not seems to exist (
/etc/sensu/config.json: No such file or directory
) - Downloading the example config.json and restarting the sensu-api did not solve the issue
{
"rabbitmq": {
"host": "localhost",
"vhost": "/sensu",
"user": "sensu",
"password": "secret"
},
"redis": {
"host": "localhost",
"port": 6379,
"password": "secret"
}
}
- the redis port is listening:
LISTEN 0 128 127.0.0.1:6379 *:*
- the rabbitmq port as well:
LISTEN 0 100 *:4567 *:*
- Uchiwa cannot connect to the datacenters
{
"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"}
- navigating to
<IPADDRESS>:4567
results in:
{"error":"redis and transport connections not initialized"}
- redis replies
sudo redis-cli ping
PONG
- redis password was set, but the issue persists
sudo redis-cli
127.0.0.1:6379> auth secret
OK
I first got RabbitMQ working when I set up correct SSL config in rabbitmq.json, it shows an example on the Sensu Website. After that it only said: "error": "not connected to redis"
I then got Redis working by changing from "localhost" in the sensu config to "127.0.0.1". Since Redis wasn't listening on IPv6 and "localhost" resolved both ::1 & 127.0.0.1 it didn't work properly.
This was a fresh install on Debian 8.
Concise
The
sensu-client
seems to require a runningrabbitmq-server
. As this message broker did not seem to be running neither thesensu-client
was able to start, nor the Uchiwa dashboard was able to monitor it.Verbose
If the following error:
is shown and
redis
is listening, please check thatrabbitmq
is running and check the rabbitmq port using rabbitmq-status:Example
Today the above error was shown and when the rabbitmq port was checked it appeared that a certain port was not listening:
As SSL was configured, port 5671 should be configured in
/etc/rabbitmq.config
. Once the messagebroker server was restarted the ssl port5671
started to listen and the issue was solved:my rabbitmq config is :
Verify that sensu-api is configured and running. On centos-7.x
systemctl status sensu-api
to start the servive
systemctl start sensu-api