sensu-plugins / sensu-plugin

A framework for writing Sensu plugins & handlers with Ruby.
http://sensuapp.org
MIT License
126 stars 117 forks source link

Fixed Silences #181

Closed jaboc closed 6 years ago

jaboc commented 6 years ago

Description

The handler seems to be using maybe old paths for the silence api. I updated them so that silences are found correctly..

Motivation and Context

I had to turn off sensu so I could get some sleep.

How Has This Been Tested?

Not extensively. It fixed my issue on my install.

Types of changes

Minor edits to the handler

Checklist:

Known Caveats

majormoses commented 6 years ago

Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly.

majormoses commented 6 years ago

Yes this is using the old stash api the change can be read about here: https://github.com/sensu/sensu/blob/master/CHANGELOG.md#0260---2016-09-06

This makes it a breaking change for clients >= 0.26.

majormoses commented 6 years ago

I need a changelog entry and a testing artifact

cwjohnston commented 6 years ago

I don't think this change makes sense.

The filter_silenced method is deprecated. Sensu 0.26 and later include silencing as a native concept. Leaving the filter_silenced method as-is was intentional, as we wanted to maintain backward compatibility with the stash-based silencing workflow.

Note that under the native silencing implementation handlers are not executed for a silenced event, unless the handler definition specifies "handle_silenced": true. This means that an event which is silenced via the /silenced API will generally not be passed to this filtering method at all. In this light, making additional calls to the API doesn't make much sense to me.

majormoses commented 6 years ago

@cwjohnston ah that makes sense, I knew there was something I was missing.

portertech commented 6 years ago

Closing, as this does not make sense. Native Sensu silencing is applied before any sensu-plugin execution. Silence stashes are a legacy method of silencing, a relic of the past.

cwjohnston commented 6 years ago

@jaboc I suspect that your need for this change may have arisen from some confusion around the upgrade path for native Sensu silencing. Hit me up on the Sensu Community Slack if you need help making sense of all this.