Error on stating sensu server "sensu must be a hash"

I’m gettting this error

{"timestamp":"2018-01-24T18:59:32.875053+0530","level":"fatal","message":"sensu must be a hash","object":[{"name":"Datacenter 1","host":"localhost","port":4567}]}

My configs are:

config.json


{}

conf.d/api.json


{

"api": {

"host": "127.0.0.1",

"bind": "0.0.0.0",

"port": 4567

}

}

conf.d/client.json


{

"client": {

"name": "sensu-server",

"address": "127.0.0.1",

"environment": "development",

"subscriptions": [

"dev",

"ubuntu"

],

"socket": {

"bind": "127.0.0.1",

"port": 3030

}

}

}

conf.d/redis.json


{

"redis": {

"host": "127.0.0.1",

"port": 6379

}

}

conf.d/rabbitmq.json


{

"rabbitmq": {

"host": "127.0.0.1",

"port": 5672,

"vhost": "/sensu",

"user": "sensu",

"password": "secret"

}

}

conf.d/transport.json


{

"transport": {

"name": "rabbitmq",

"reconnect_on_error": true

}

}

My sensu-srever logs are


{"timestamp":"2018-01-24T19:11:00.726690+0530","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/transport.json"}

{"timestamp":"2018-01-24T19:11:00.726728+0530","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/transport.json","changes":{}}

{"timestamp":"2018-01-24T19:11:00.726751+0530","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/rabbitmq.json"}

{"timestamp":"2018-01-24T19:11:00.726780+0530","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/rabbitmq.json","changes":{"rabbitmq":[null,{"host":"127.0.0.1","port":5672,"vhost":"/sensu","user":"sensu","password":"REDACTED"}]}}

{"timestamp":"2018-01-24T19:11:00.726804+0530","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/check_disk_usage_linux.json"}

{"timestamp":"2018-01-24T19:11:00.726838+0530","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/check_disk_usage_linux.json","changes":{"checks":{"check-disk-usage-linux":[null,{"handlers":["mailer"],"command":"/opt/sensu/embedded/bin/check-disk-usage.rb -w 80 -c 90","interval":60,"occurrences":5,"subscribers":["linux"]}]}}}

{"timestamp":"2018-01-24T19:11:00.726864+0530","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/check_memory_linux.json"}

{"timestamp":"2018-01-24T19:11:00.726902+0530","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/check_memory_linux.json","changes":{"checks":{"check_memory_linux":[null,{"handlers":["mailer"],"command":"/opt/sensu/embedded/bin/check-memory-percent.rb -w 90 -c 95","interval":60,"occurrences":5,"subscribers":["linux"]}]}}}

{"timestamp":"2018-01-24T19:11:00.726934+0530","level":"fatal","message":"sensu must be a hash","object":[{"name":"Datacenter 1","host":"localhost","port":4567}]}

{"timestamp":"2018-01-24T19:11:00.726957+0530","level":"fatal","message":"SENSU NOT RUNNING!"}

Define “sensu” in dashboard.json?
https://github.com/sensu/sensu-docs/blob/master/legacy/0.17/files/dashboard.json

Whenever I have problems like this the first thing I recommend is to validate that every config file is valid json.


$ gem install jsonlint

Successfully installed jsonlint-0.2.0

Parsing documentation for jsonlint-0.2.0

Done installing documentation for jsonlint after 0 seconds

1 gem installed

And then search for .json files and validate them:


# remember to adjust the path you are searching and sudo if neccessary

find . -name '*.json' -exec jsonlint {} \;

Once you know you have valid json you can then take a closer look at your config.

{“timestamp”:“2018-01-24T19:11:00.726934+0530”,“level”:“fatal”,“message”:“sensu must be a hash”,“object”:[{“name”:“Datacenter 1”,“host”:“localhost”,“port”:4567}]}

You could try fixing it so that sensu loads them properly but I happen to know that is uchiwa config rather than sensu config meaning that it is in the wrong directory. Trying moving it out of /etc/sensu/conf.d/ into /etc/sensu/ which should not try to load that json file into its own config. That being said you should probably check to make sure its valid uchiwa config via its docs.

···

On Wednesday, January 24, 2018 at 5:43:24 AM UTC-8, priy...@launchyard.com wrote:

I’m gettting this error

{"timestamp":"2018-01-24T18:59:32.875053+0530","level":"fatal","message":"sensu must be a hash","object":[{"name":"Datacenter 1","host":"localhost","port":4567}]}

My configs are:

config.json

{}

conf.d/api.json

{

“api”: {

“host”: “127.0.0.1”,

“bind”: “0.0.0.0”,

“port”: 4567

}

}

conf.d/client.json

{

“client”: {

“name”: “sensu-server”,

“address”: “127.0.0.1”,

“environment”: “development”,

“subscriptions”: [

“dev”,

“ubuntu”

],

“socket”: {

“bind”: “127.0.0.1”,

“port”: 3030

}

}

}

conf.d/redis.json

{

“redis”: {

“host”: “127.0.0.1”,

“port”: 6379

}

}

conf.d/rabbitmq.json

{

“rabbitmq”: {

“host”: “127.0.0.1”,

“port”: 5672,

“vhost”: “/sensu”,

“user”: “sensu”,

“password”: “secret”

}

}

conf.d/transport.json

{

“transport”: {

“name”: “rabbitmq”,

“reconnect_on_error”: true

}

}

My sensu-srever logs are

{“timestamp”:“2018-01-24T19:11:00.726690+0530”,“level”:“warn”,“message”:“loading config file”,“file”:“/etc/sensu/conf.d/transport.json”}

{“timestamp”:“2018-01-24T19:11:00.726728+0530”,“level”:“warn”,“message”:“config file applied changes”,“file”:“/etc/sensu/conf.d/transport.json”,“changes”:{}}

{“timestamp”:“2018-01-24T19:11:00.726751+0530”,“level”:“warn”,“message”:“loading config file”,“file”:“/etc/sensu/conf.d/rabbitmq.json”}

{“timestamp”:“2018-01-24T19:11:00.726780+0530”,“level”:“warn”,“message”:“config file applied changes”,“file”:“/etc/sensu/conf.d/rabbitmq.json”,“changes”:{“rabbitmq”:[null,{“host”:“127.0.0.1”,“port”:5672,“vhost”:“/sensu”,“user”:“sensu”,“password”:“REDACTED”}]}}

{“timestamp”:“2018-01-24T19:11:00.726804+0530”,“level”:“warn”,“message”:“loading config file”,“file”:“/etc/sensu/conf.d/check_disk_usage_linux.json”}

{“timestamp”:“2018-01-24T19:11:00.726838+0530”,“level”:“warn”,“message”:“config file applied changes”,“file”:“/etc/sensu/conf.d/check_disk_usage_linux.json”,“changes”:{“checks”:{“check-disk-usage-linux”:[null,{“handlers”:[“mailer”],“command”:“/opt/sensu/embedded/bin/check-disk-usage.rb -w 80 -c 90”,“interval”:60,“occurrences”:5,“subscribers”:[“linux”]}]}}}

{“timestamp”:“2018-01-24T19:11:00.726864+0530”,“level”:“warn”,“message”:“loading config file”,“file”:“/etc/sensu/conf.d/check_memory_linux.json”}

{“timestamp”:“2018-01-24T19:11:00.726902+0530”,“level”:“warn”,“message”:“config file applied changes”,“file”:“/etc/sensu/conf.d/check_memory_linux.json”,“changes”:{“checks”:{“check_memory_linux”:[null,{“handlers”:[“mailer”],“command”:“/opt/sensu/embedded/bin/check-memory-percent.rb -w 90 -c 95”,“interval”:60,“occurrences”:5,“subscribers”:[“linux”]}]}}}

{“timestamp”:“2018-01-24T19:11:00.726934+0530”,“level”:“fatal”,“message”:“sensu must be a hash”,“object”:[{“name”:“Datacenter 1”,“host”:“localhost”,“port”:4567}]}

{“timestamp”:“2018-01-24T19:11:00.726957+0530”,“level”:“fatal”,“message”:“SENSU NOT RUNNING!”}