Class: Flapjack::Filters::Acknowledgement
- Inherits:
-
Object
- Object
- Flapjack::Filters::Acknowledgement
- Includes:
- Base
- Defined in:
- lib/flapjack/filters/acknowledgement.rb
Overview
-
If the action event’s state is an acknowledgement, and the corresponding check is in a failure state, then set unscheduled maintenance for 4 hours on the check
-
If the action event’s state is an acknowledgement, and the corresponding check is not in a failure state, then don’t alert
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#block?(check, opts = {}) ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/flapjack/filters/acknowledgement.rb', line 16 def block?(check, opts = {}) old_state = opts[:old_state] new_state = opts[:new_state] = opts[:timestamp] label = 'Filter: Acknowledgement:' unless 'acknowledgement'.eql?(new_state.action) Flapjack.logger.debug { "#{label} pass (not an ack)" } return false end if old_state.nil? || Flapjack::Data::Condition.healthy?(old_state.condition) Flapjack.logger.debug { "#{label} blocking because check '#{check.name}' is not failing" } return true end end_time = + (opts[:duration] || (4 * 60 * 60)) unsched_maint = Flapjack::Data::UnscheduledMaintenance.new(:start_time => , :end_time => end_time, :summary => new_state.summary) unsched_maint.save check.set_unscheduled_maintenance(unsched_maint) Flapjack.logger.debug{ "#{label} pass (unscheduled maintenance created for #{check.name}, " \ " duration: #{end_time - })" } false end |