Sha256: 0633dbbf3873fd495201225f4bb2da0c75324209fd02cdd3b1c4a14649c942df

Contents?: true

Size: 897 Bytes

Versions: 29

Compression:

Stored size: 897 Bytes

Contents

#!/usr/bin/env ruby

require 'flapjack/filters/base'

module Flapjack
  module Filters

    # * If the service event’s state is ok and the previous state was ok, don’t alert
    # * If the service event's state is ok and there is unscheduled downtime set, end the unscheduled
    #   downtime
    class Ok
      include Base

      def block?(event)
        result = false

        if event.ok?
          if event.previous_state == 'ok'
            @log.debug("Filter: Ok: existing state was ok, and the previous state was ok, so blocking")
            result = true
          end

          # end any unscheduled downtime
          entity_check = Flapjack::Data::EntityCheck.for_event_id(event.id, :redis => @persistence)
          entity_check.end_unscheduled_maintenance
        end

        @log.debug("Filter: Ok: #{result ? "block" : "pass"}")
        result
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
flapjack-0.6.51 lib/flapjack/filters/ok.rb
flapjack-0.6.50 lib/flapjack/filters/ok.rb
flapjack-0.6.49 lib/flapjack/filters/ok.rb
flapjack-0.6.48 lib/flapjack/filters/ok.rb
flapjack-0.6.47 lib/flapjack/filters/ok.rb
flapjack-0.6.46 lib/flapjack/filters/ok.rb
flapjack-0.6.45 lib/flapjack/filters/ok.rb
flapjack-0.6.44 lib/flapjack/filters/ok.rb
flapjack-0.6.43 lib/flapjack/filters/ok.rb
flapjack-0.6.42 lib/flapjack/filters/ok.rb
flapjack-0.6.41 lib/flapjack/filters/ok.rb
flapjack-0.6.40 lib/flapjack/filters/ok.rb
flapjack-0.6.39 lib/flapjack/filters/ok.rb
flapjack-0.6.38 lib/flapjack/filters/ok.rb
flapjack-0.6.37 lib/flapjack/filters/ok.rb
flapjack-0.6.36 lib/flapjack/filters/ok.rb
flapjack-0.6.35 lib/flapjack/filters/ok.rb
flapjack-0.6.34 lib/flapjack/filters/ok.rb
flapjack-0.6.33 lib/flapjack/filters/ok.rb
flapjack-0.6.32 lib/flapjack/filters/ok.rb