sensu-plugins / sensu-plugins-opsgenie

Sensu plugins for OpsGenie
http://sensu-plugins.io
MIT License
4 stars 24 forks source link

Handler doesnt have a filter for "occurrences" or "refresh" #33

Open techmjohnson opened 6 years ago

techmjohnson commented 6 years ago

The current iteration of the handler doesn't handle the occurrences or refresh filters. Even if we pass this down through sensu to the handler, it's currently ignored.

Example check can be defined like this, but all "additional" values must be used by the handler or they're ignored:

sensu_check 'nameofcheck' do command 'runsomescript.sh' handlers opsgenie interval 120 timeout 60 additional(:occurrences => 2, :refresh => 10, :ttl => 30) standalone true end

expected filter in the handler would be able to validate that this check has met the following requirements before notifying: failed 2 times in a row (occurrences) would run again after 10 seconds (refresh) and would kill itself after 30 seconds (ttl)

Castaglia commented 6 years ago

These behaviors can also be configured using Sensu filters, or by configuring flapping thresholds for the individual Sensu checks. These "occurrences" or "refresh" behaviors should not be specific to the OpsGenie handler, but something that is done in Sensu, for any handler.

Evesy commented 6 years ago

@techmjohnson As @Castaglia says, occurrences and refresh behaviour in the more recent versions of Sensu is something that the built in occurrences filter (https://github.com/sensu-extensions/sensu-extensions-occurrences) observes by default. To get the behaviour you want you should just need to have the occurrences filter set on your handler.

If you also want the handler to be killed after a certain period you can set timeout on your handler definition.

techmjohnson commented 6 years ago

concur, we can close this one up.

varet80 commented 6 years ago

Even though setting the filter in my handler, this is not honnored in my case.