lib/sensu/server/filter.rb
# Determine if an event with a check severity will be handled.
# Event handlers can specify the check severities they will
# handle, using the definition attribute `:severities`. The
# possible severities are "ok", "warning", "critical", and
# "unknown". Handler severity filtering is bypassed when the
# event `:action` is `:resolve` and a previous check history
# status identifies a severity specified in the handler
# definition. It's possible for a check history status of 0 to
# have had the flapping action, so we are unable to consider
# every past 0 to indicate a resolution.
#
# @param handler [Hash] definition.
# @param event [Hash]
# @return [TrueClass, FalseClass]
Determine if an event with a check severity will be handled.
Event handlers can specify the check severities they will
handle, using the definition attribute `:severities`.
Determine if an event with a check severity will be handled . Event handlers can specify the check severities they will handle using the definition attribute ` : severities ` .
def handle_severity?(handler, event)
        if handler.has_key?(:severities)
          case event[:action]
          when :resolve
            event[:check][:history].any? do |status|
              severity = SEVERITIES[status.to_i] || "unknown"
              handler[:severities].include?(severity)
            end
          else
            severity = SEVERITIES[event[:check][:status]] || "unknown"
            handler[:severities].include?(severity)
          end
        else
          true
        end
      end
def handle_severity? ( handler , event ) if handler . has_key? ( :severities ) case event [ :action ] when :resolve event [ :check ] [ :history ] . any? do | status | severity = SEVERITIES [ status . to_i ] || "unknown" handler [ :severities ] . include? ( severity ) end else severity = SEVERITIES [ event [ :check ] [ :status ] ] || "unknown" handler [ :severities ] . include? ( severity ) end else true end end
Determine if an event with a check severity will be handled.
Determine if an event with a check severity will be handled .
None
TrueClass, FalseClass
handler
None
event
None