Closed oddboy closed 6 years ago
That sounds like you dont have a key anywhere defined with api.settings
the error message is not great and should probably say something along the lines of:
unless settings.key?('api')
raise 'api.json key in settings is not found. Define it in a json config `/etc/sensu/conf.d` or in any other config file that sensu imports'
end
Its usually defined in /etc/sensu/config.json
and should look something like this:
{
"api": {
"host": "localhost",
"bind": "0.0.0.0",
"port": 4567
}
}
Documentation: https://docs.sensu.io/sensu-core/1.4/platforms/sensu-on-ubuntu-debian/#example-data-store-configuration
I have opened #59 to improve the error message around this.
Hi,
I'm fairly new to sensu, and moving some checks over from nagios. I wanted to be able to purge stale check results so this plugin looked awesome.
However, when I run it, I get an error "Check failed to run: api.json settings not found.
Here's the complete text:
[root@linux4 bin]# ./check-stale-results.rb -c 10 -w 5 -s 1d Check failed to run: api.json settings not found., ["/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-3.0.0/bin/check-stale-results.rb:72:in'"]
api_request'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-3.0.0/bin/check-stale-results.rb:87:in
results'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-3.0.0/bin/check-stale-results.rb:52:ininitialize'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-2.5.0/lib/sensu-plugin/cli.rb:56:in
new'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-2.5.0/lib/sensu-plugin/cli.rb:56:in `block inI'm thinking that I need a json file in /etc/sensu/conf.d, but I have no idea what should be in it. Google didn't help much.
I'm pretty handy, though ruby isn't my first language.
If anyone has some hints, I'd sure appreciate it!
Thanks!
J