Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.json settings not found #58

Closed
oddboy opened this issue Jun 29, 2018 · 4 comments · Fixed by #59
Closed

api.json settings not found #58

oddboy opened this issue Jun 29, 2018 · 4 comments · Fixed by #59

Comments

@oddboy
Copy link

oddboy commented Jun 29, 2018

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:in initialize'", "/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 in class:CLI'"]

I'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

@majormoses
Copy link
Member

majormoses commented Jun 30, 2018

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

@majormoses
Copy link
Member

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

@majormoses majormoses mentioned this issue Jun 30, 2018
5 tasks
@majormoses
Copy link
Member

I have opened #59 to improve the error message around this.

@majormoses
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants