我得到了这个错误
{"timestamp":"2018-01-24T18:59:32.875053+0530","level":"fatal","message":"sensu must be a hash","object":[{"name":"Datacenter 1","host":"localhost","port":4567}]}
我的配置是: 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
}
}我的感官记录是
{"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!"}并且我的配置json格式正确,但仍然显示此错误
发布于 2018-01-25 03:47:34
您可以使用JQ (apt-get install jq)或jsonlint验证您的配置。错误的json文件或丢失的配置文件可能会导致"sensu必须是散列“问题。
https://stackoverflow.com/questions/48424790
复制相似问题