Uchiwa unable to connect to Sensu API

Hello,

I am running Sensu (Version: sensu:amd64/sensu 0.25.7-1) on a Debian VM (Debian 4.5.3).

I installed Uchiwa (uchiwa:amd64/sensu 0.17.1-1).

The dashboard shows an alert:

Datacenter my-vm returned: Connection error. Is the Sensu API running?

I set the Sensu log level to debug in /etc/default/sensu:
LOG_LEVEL=debug

``

In the Uchiwa log (/var/log/uchiwa.log) I see the following message:

{“timestamp”:“2016-09-05T14:11:26.656214894+03:00”,“level”:“info”,“message”:“Updating the datacenter my-vm”}
{“timestamp”:“2016-09-05T14:11:26.657634518+03:00”,“level”:“warn”,“message”:“GET http://my-vm.example.com:4567/stashes returned: 500 Internal Server Error”}
{“timestamp”:“2016-09-05T14:11:26.65765716+03:00”,“level”:“warn”,“message”:“Connection failed to the datacenter my-vm”}

``

The configuration:

/etc/sensu/uchiwa.json

{
“sensu”: [
{
“name”: “my-vm”,
“host”: “my-vm.example.com”,
“port”: 4567,
“timeout”: 10
}
],
“uchiwa”: {
“host”: “0.0.0.0”,
“port”: 3000,
“refresh”: 10
}
}

``

/etc/sensu/conf.d/api.json

{
“api”: {
“host”: “my-vm.example.com”,
“bind”: “my-vm.example.com”,
“port”: 4567
}
}

``

I tried to use tcpdump, but it showed no activity on port 4567.

netstat shows that the API is listening on port 4567.

Any ideas why this might be?

Thanks!

Can you do a curl -vv http://my-vm.example.com:4567/stashes on the system you are running the API?

···

On Monday, 5 September 2016 17:20:05 UTC+5:30, Yaron Yogev wrote:

Hello,

I am running Sensu (Version: sensu:amd64/sensu 0.25.7-1) on a Debian VM (Debian 4.5.3).

I installed Uchiwa (uchiwa:amd64/sensu 0.17.1-1).

The dashboard shows an alert:

Datacenter my-vm returned: Connection error. Is the Sensu API running?

I set the Sensu log level to debug in /etc/default/sensu:
LOG_LEVEL=debug

``

In the Uchiwa log (/var/log/uchiwa.log) I see the following message:

{“timestamp”:“2016-09-05T14:11:26.656214894+03:00”,“level”:“info”,“message”:“Updating the datacenter my-vm”}
{“timestamp”:“2016-09-05T14:11:26.657634518+03:00”,“level”:“warn”,“message”:“GET http://my-vm.example.com:4567/stashes returned: 500 Internal Server Error”}
{“timestamp”:“2016-09-05T14:11:26.65765716+03:00”,“level”:“warn”,“message”:“Connection failed to the datacenter my-vm”}

``

The configuration:

/etc/sensu/uchiwa.json

{
“sensu”: [
{
“name”: “my-vm”,
“host”: “my-vm.example.com”,
“port”: 4567,
“timeout”: 10
}
],
“uchiwa”: {
“host”: “0.0.0.0”,
“port”: 3000,
“refresh”: 10
}
}

``

/etc/sensu/conf.d/api.json

{
“api”: {
“host”: “my-vm.example.com”,
“bind”: “my-vm.example.com”,
“port”: 4567
}
}

``

I tried to use tcpdump, but it showed no activity on port 4567.

netstat shows that the API is listening on port 4567.

Any ideas why this might be?

Thanks!

I got this error: :“redis and transport connections not initialized”

yarony@my-vm:/etc/sensu$ curl -vv http://my-vm:4567/stashes

  • Trying 127.0.1.1…
  • Connected to my-vm (127.0.1.1) port 4567 (#0)

GET /stashes HTTP/1.1
Host: my-vm:4567
User-Agent: curl/7.50.1
Accept: /

< HTTP/1.1 500 Internal Server Error
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
< Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
< Access-Control-Allow-Origin: *
< Connection: close
< Content-length: 59
< Content-type: application/json
<

  • Closing connection 0
    {“error”:“redis and transport connections not initialized”}
    yarony@my-vm:/etc/sensu$

``

Strange, as I did not see any error message in sensu-api.log and sensu-server.log.

בתאריך יום שני, 5 בספטמבר 2016 בשעה 16:06:29 UTC+3, מאת Jay Kumar:

···

Can you do a curl -vv http://my-vm.example.com:4567/stashes on the system you are running the API?

On Monday, 5 September 2016 17:20:05 UTC+5:30, Yaron Yogev wrote:

Hello,

I am running Sensu (Version: sensu:amd64/sensu 0.25.7-1) on a Debian VM (Debian 4.5.3).

I installed Uchiwa (uchiwa:amd64/sensu 0.17.1-1).

The dashboard shows an alert:

Datacenter my-vm returned: Connection error. Is the Sensu API running?

I set the Sensu log level to debug in /etc/default/sensu:
LOG_LEVEL=debug

``

In the Uchiwa log (/var/log/uchiwa.log) I see the following message:

{“timestamp”:“2016-09-05T14:11:26.656214894+03:00”,“level”:“info”,“message”:“Updating the datacenter my-vm”}
{“timestamp”:“2016-09-05T14:11:26.657634518+03:00”,“level”:“warn”,“message”:“GET http://my-vm.example.com:4567/stashes returned: 500 Internal Server Error”}
{“timestamp”:“2016-09-05T14:11:26.65765716+03:00”,“level”:“warn”,“message”:“Connection failed to the datacenter my-vm”}

``

The configuration:

/etc/sensu/uchiwa.json

{
“sensu”: [
{
“name”: “my-vm”,
“host”: “my-vm.example.com”,
“port”: 4567,
“timeout”: 10
}
],
“uchiwa”: {
“host”: “0.0.0.0”,
“port”: 3000,
“refresh”: 10
}
}

``

/etc/sensu/conf.d/api.json

{
“api”: {
“host”: “my-vm.example.com”,
“bind”: “my-vm.example.com”,
“port”: 4567
}
}

``

I tried to use tcpdump, but it showed no activity on port 4567.

netstat shows that the API is listening on port 4567.

Any ideas why this might be?

Thanks!

Problem solved - partially:

I saw that rabbitmq log file ( /var/log/rabbitmq/rabbit@my-vm.log) had an error:

=ERROR REPORT==== 4-Sep-2016::07:35:18 ===

Error on AMQP connection <0.4746.7> (10.56.20.239:59486 -> 10.56.20.84:5672, state: starting):

PLAIN login refused: user ‘sensu’ - invalid credentials

Indeed, my rabbitmq.json file had: user=sensu, password=sensu. After removing it the error was gone. As now it was operating with use ‘guest’ I had to make the API work on 127.0.0.1, after which all is working fine with Uchiwa.

However, I want to run a standalone check on a remote host. If I understand correctly, this means I have to make the remote host report the check result using the server transport, i.e. RabbitMQ.

So this means I need to solve the RabbitMQ authentication issues so I can have the standalone check reported to the server.

Did you configure your RabbitMQ server for use with sensu? You have to create the sensu user and the /sensu vhost. Details are at https://sensuapp.org/docs/0.26/installation/install-rabbitmq-on-ubuntu-debian.html#create-a-dedicated-rabbitmq-vhost-for-sensu

Cheers,

Joel

···

On Monday, 5 September 2016 16:33:03 UTC+1, Yaron Yogev wrote:

Problem solved - partially:

I saw that rabbitmq log file ( /var/log/rabbitmq/rabbit@my-vm.log) had an error:

=ERROR REPORT==== 4-Sep-2016::07:35:18 ===

Error on AMQP connection <0.4746.7> (10.56.20.239:5948610.56.20.84:5672, state: starting):

PLAIN login refused: user ‘sensu’ - invalid credentials

Indeed, my rabbitmq.json file had: user=sensu, password=sensu. After removing it the error was gone. As now it was operating with use ‘guest’ I had to make the API work on 127.0.0.1, after which all is working fine with Uchiwa.

However, I want to run a standalone check on a remote host. If I understand correctly, this means I have to make the remote host report the check result using the server transport, i.e. RabbitMQ.

So this means I need to solve the RabbitMQ authentication issues so I can have the standalone check reported to the server.

Apparently I missed that. Now I have set a vhost and the sensu user, and all seems to be working nicely.
I would suggest to improve the documentation on that part by adding bullets with links to the appropriate page discussing configuration of the chosen transport.

Currently it’s too easy to miss that.

Thanks to you and Jay for pointing me in the right direction!

Cheers,

Yaron

···

On Tuesday, September 6, 2016 at 1:43:56 PM UTC+3, joel....@hscic.gov.uk wrote:

Did you configure your RabbitMQ server for use with sensu? You have to create the sensu user and the /sensu vhost. Details are at https://sensuapp.org/docs/0.26/installation/install-rabbitmq-on-ubuntu-debian.html#create-a-dedicated-rabbitmq-vhost-for-sensu

Cheers,

Joel

On Monday, 5 September 2016 16:33:03 UTC+1, Yaron Yogev wrote:

Problem solved - partially:

I saw that rabbitmq log file ( /var/log/rabbitmq/rabbit@my-vm.log) had an error:

=ERROR REPORT==== 4-Sep-2016::07:35:18 ===

Error on AMQP connection <0.4746.7> (10.56.20.239:5948610.56.20.84:5672, state: starting):

PLAIN login refused: user ‘sensu’ - invalid credentials

Indeed, my rabbitmq.json file had: user=sensu, password=sensu. After removing it the error was gone. As now it was operating with use ‘guest’ I had to make the API work on 127.0.0.1, after which all is working fine with Uchiwa.

However, I want to run a standalone check on a remote host. If I understand correctly, this means I have to make the remote host report the check result using the server transport, i.e. RabbitMQ.

So this means I need to solve the RabbitMQ authentication issues so I can have the standalone check reported to the server.