lib/sensu/server/process.rb
# Process a check result, storing its data, inspecting its
# contents, and taking the appropriate actions (eg. update the
# event registry). The `@in_progress[:check_results]` counter is
# incremented by `1` prior to check result processing and then
# decremented by `1` after updating the event registry. A check
# result must have a valid client name, associated with a client
# in the registry or one will be created. If a local check
# definition exists for the check name, and the check result is
# not from a standalone check execution, it's merged with the
# check result for more context.
#
# @param result [Hash] data.
Process a check result, storing its data, inspecting its
contents, and taking the appropriate actions .
Process a check result storing its data inspecting its contents and taking the appropriate actions .
def process_check_result(result)
        @in_progress[:check_results] += 1
        @logger.debug("processing result", :result => result)
        retrieve_client(result) do |client|
          unless client.nil?
            check = case
            when @settings.check_exists?(result[:check][:name]) && !result[:check][:standalone]
              @settings[:checks][result[:check][:name]].merge(result[:check])
            else
              result[:check]
            end
            check[:type] ||= STANDARD_CHECK_TYPE
            check[:origin] = result[:client] if check[:source]
            if @settings.check_exists?(check[:name]) && client[:type] == "proxy"
              check[:command] = @settings[:checks][check[:name].to_sym][:command]
            end
            aggregate_check_result(client, check) if check[:aggregates] || check[:aggregate]
            store_check_result(client, check) do
              create_event(client, check) do |event|
                event_bridges(event)
                update_event_registry(event) do |process|
                  process_event(event) if process
                  @in_progress[:check_results] -= 1
                end
              end
            end
          else
            @logger.warn("halting result processing", :result => result)
            @in_progress[:check_results] -= 1
          end
        end
      end
def process_check_result ( result ) @in_progress [ :check_results ] += 1 @logger . debug ( "processing result" , :result => result ) retrieve_client ( result ) do | client | unless client . nil? check = case when @settings . check_exists? ( result [ :check ] [ :name ] ) && ! result [ :check ] [ :standalone ] @settings [ :checks ] [ result [ :check ] [ :name ] ] . merge ( result [ :check ] ) else result [ :check ] end check [ :type ] ||= STANDARD_CHECK_TYPE check [ :origin ] = result [ :client ] if check [ :source ] if @settings . check_exists? ( check [ :name ] ) && client [ :type ] == "proxy" check [ :command ] = @settings [ :checks ] [ check [ :name ] . to_sym ] [ :command ] end aggregate_check_result ( client , check ) if check [ :aggregates ] || check [ :aggregate ] store_check_result ( client , check ) do create_event ( client , check ) do | event | event_bridges ( event ) update_event_registry ( event ) do | process | process_event ( event ) if process @in_progress [ :check_results ] -= 1 end end end else @logger . warn ( "halting result processing" , :result => result ) @in_progress [ :check_results ] -= 1 end end end
Process a check result, storing its data, inspecting its
contents, and taking the appropriate actions (eg.
Process a check result storing its data inspecting its contents and taking the appropriate actions ( eg .
result
None