cvtienhoven / sensu-plugin-auto-resolve

A plugin for Sensu to auto-resolve events after a specified amount of seconds
4 stars 0 forks source link

Error when lauching handler #1

Open jothoma1 opened 7 years ago

jothoma1 commented 7 years ago

Hi ! I'm trying to use your handler, by the way, you are doing really great work with the tools i use too (sensu, graylog :) ). I'm having an issue when the handler run, here is the error (undefined method `parse' for Sensu::JSON:Module (NoMethodError))

{"timestamp":"2017-06-28T03:51:12.470413+0200","level":"info","message":"Starting execution of periodic auto_resolve run"} /etc/sensu/extensions/handlers/auto_resolve.rb:90:in periodic_auto_resolve_expiration': undefined methodparse' for Sensu::JSON:Module (NoMethodError) from /etc/sensu/extensions/handlers/auto_resolve.rb:45:in block in post_init' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.2/lib/em/timers.rb:56:infire' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.2/lib/eventmachine.rb:194:in call' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.2/lib/eventmachine.rb:194:inrun_machine' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.2/lib/eventmachine.rb:194:in run' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-0.29.0/lib/sensu/server/process.rb:33:inrun' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-0.29.0/exe/sensu-server:10:in <top (required)>' from /opt/sensu/bin/sensu-server:22:inload' from /opt/sensu/bin/sensu-server:22:in `

'

If you have an idea ?

cvtienhoven commented 7 years ago

Hmm I'm running this with a Sensu version that has the 2.2.0 embedded Ruby version instead of 2.4.0, but I don't think that's the issue here. It seems like it's failing when parsing the stashes response from the API. Could you check your if your API is up and running correctly?

Also probably not the issue, but do you have a conf file like /etc/sensu/conf.d/extentions/auto_resolve.json? If not, you might try to create one with the following contents:

{
  "auto_resolve": {
  }
}
jothoma1 commented 7 years ago

Thanks for your help. Yes the API is up and running and i have the conf file. It failed with :

/etc/sensu/extensions/handlers/auto_resolve.rb:90:in periodic_auto_resolve_expiration': undefined methodparse' for Sensu::JSON:Module (NoMethodError)

jothoma1 commented 7 years ago

Hi, another problem, when trying auto_resolve.rb with sensu 1.0, sensu crash

ushacow commented 6 years ago

Hey! I've resolved this issue. Try to use ::JSON.parse (external lib) instead of JSON.parse. It seems there is JSON lib without parse() method in new Sensu (I have Sensu 1.2) or something else.

ecsumed commented 5 years ago

@ushacow Same problem here on 0.29. Resolved with ::JSON