check dependency issue while using extension handlers


#1

Hi,

I have integrated sensu with flapjack by using https://github.com/sensu/sensu-community-plugins/blob/master/extensions/handlers/flapjack.rb handler as an extension. But my checks have dependency relations and flapjack.rb ignores these relations and send alerts to flapjack for every check result.

As far as I understand, without extensions, Handler classes derive from https://github.com/sensu/sensu-plugin/blob/master/lib/sensu-handler.rb and this class implements filter_dependencies but handler classes written as an extension does not implement that (https://github.com/sensu/sensu-extension/blob/master/lib/sensu/extension.rb).

Any solution or workaround for the issue?


#2

Hmmm...

In some sense, the purpose of an extension like this is to provide an
unfiltered view of the events coming from sensu.

On the other hand, sometimes it is going to be easier to suppress
check results on the producing side (nagios/sensu), as opposed to
flapjack side.

I think I would modify the flapjack handler to do what you want, by
copying in the filter logic into the run method.
Be careful though, it would have to be modified to not "bail", but
simply not put anything on redis, if filtered.
(I would also be a bit concerned about the event_exists? call, which
does a sensu-api fetch. The handler should probably.... inspect redis
directly? :frowning: )

It could be argued that this should be the default behavior of this
particular extension, other people who use it might agree and want you
to PR?

ยทยทยท

On Thu, Nov 6, 2014 at 2:25 AM, Emrecan Sezen <ecsezen@gmail.com> wrote:

Hi,

I have integrated sensu with flapjack by using
https://github.com/sensu/sensu-community-plugins/blob/master/extensions/handlers/flapjack.rb
handler as an extension. But my checks have dependency relations and
flapjack.rb ignores these relations and send alerts to flapjack for every
check result.

As far as I understand, without extensions, Handler classes derive from
https://github.com/sensu/sensu-plugin/blob/master/lib/sensu-handler.rb and
this class implements filter_dependencies but handler classes written as an
extension does not implement that
(https://github.com/sensu/sensu-extension/blob/master/lib/sensu/extension.rb).

Any solution or workaround for the issue?