lib/sensu/server/filter.rb
def filter_event(handler, event)
        handler_info = case handler[:type]
          when "extension" then handler.definition
          else handler  
        end
        details = {:handler => handler_info, :event => event}
        filter_message = case
        when handling_disabled?(event)
          "event handling disabled for event"
        when !handle_action?(handler, event)
          "handler does not handle action"
        when !handle_severity?(handler, event)
          "handler does not handle event severity"
        when handler_silenced?(handler, event)
          "handler is silenced"
        end
        if filter_message
          @logger.info(filter_message, details)
          @in_progress[:events] -= 1 if @in_progress
        else
          event_filtered?(handler, event) do |filtered, filter_name|
            unless filtered
              yield(event)
            else
              details[:filter] = filter_name
              @logger.info("event was filtered", details)
              @in_progress[:events] -= 1 if @in_progress
            end
          end
        end
      end
# Attempt to filter an event for a handler. This method will
# check to see if handling is disabled, if the event action is
# handled, if the event check severity is handled, if the
# handler is subdued, and if the event is filtered by any of the
# filters specified in the handler definition.
#
# @param handler [Hash] definition.
# @param event [Hash]
# @yield [event] callback/block called if the event has not been
#   filtered.
# @yieldparam event [Hash]
Attempt to filter an event for a handler. This method will
check to see if handling is disabled, if the event action is
handled, if the event check severity is handled, if the
handler is subdued, and if the event is filtered by any of the
filters specified in the handler definition.
Attempt to filter an event for a handler . This method will check to see if handling is disabled if the event action is handled if the event check severity is handled if the handler is subdued and if the event is filtered by any of the filters specified in the handler definition .
def filter_event(handler, event)
        handler_info = case handler[:type]
          when "extension" then handler.definition
          else handler  
        end
        details = {:handler => handler_info, :event => event}
        filter_message = case
        when handling_disabled?(event)
          "event handling disabled for event"
        when !handle_action?(handler, event)
          "handler does not handle action"
        when !handle_severity?(handler, event)
          "handler does not handle event severity"
        when handler_silenced?(handler, event)
          "handler is silenced"
        end
        if filter_message
          @logger.info(filter_message, details)
          @in_progress[:events] -= 1 if @in_progress
        else
          event_filtered?(handler, event) do |filtered, filter_name|
            unless filtered
              yield(event)
            else
              details[:filter] = filter_name
              @logger.info("event was filtered", details)
              @in_progress[:events] -= 1 if @in_progress
            end
          end
        end
      end
def filter_event ( handler , event ) handler_info = case handler [ :type ] when "extension" then handler . definition else handler end details = { :handler => handler_info , :event => event } filter_message = case when handling_disabled? ( event ) "event handling disabled for event" when ! handle_action? ( handler , event ) "handler does not handle action" when ! handle_severity? ( handler , event ) "handler does not handle event severity" when handler_silenced? ( handler , event ) "handler is silenced" end if filter_message @logger . info ( filter_message , details ) @in_progress [ :events ] -= 1 if @in_progress else event_filtered? ( handler , event ) do | filtered , filter_name | unless filtered yield ( event ) else details [ :filter ] = filter_name @logger . info ( "event was filtered" , details ) @in_progress [ :events ] -= 1 if @in_progress end end end end
Attempt to filter an event for a handler.
Attempt to filter an event for a handler .
handler
None
event
None
]
callback/block called if the event has not been filtered.
callback / block called if the event has not been filtered .