lib/sensu/client/process.rb
def process_check_request(check)
        @logger.debug("processing check", :check => check)
        if @settings.check_exists?(check[:name]) && !check.has_key?(:proxy_requests)
          check.merge!(@settings[:checks][check[:name]])
        end
        if check.has_key?(:command)
          if @safe_mode && !@settings.check_exists?(check[:name])
            check[:output] = "Check is not locally defined (safe mode)"
            check[:status] = 3
            check[:handle] = false
            check[:executed] = Time.now.to_i
            publish_check_result(check)
          else
            execute_check_command(check)
          end
        else
          extension_name = check[:extension] || check[:name]
          if @extensions.check_exists?(extension_name)
            run_check_extension(check)
          else
            @logger.warn("unknown check extension", :check => check)
          end
        end
      end
# Process a check request. If a check request has a check
# command, it will be executed. A standard check request will be
# merged with a local check definition, if present. Client safe
# mode is enforced in this method, requiring a local check
# definition in order to execute the check command. If a local
# check definition does not exist when operating with client
# safe mode, a check result will be published to report the
# missing check definition. A check request without a
# command indicates a check extension run. The check request may
# contain `:extension`, the name of the extension to run. If
# `:extension` is not present, the check name is used for the
# extension name. If a check extension does not exist for a
# name, a check result will be published to report the unknown
# check extension.
#
# @param check [Hash]
Process a check request. If a check request has a check
command, it will be executed. A standard check request will be
merged with a local check definition, if present. Client safe
mode is enforced in this method, requiring a local check
definition in order to execute the check command. If a local
check definition does not exist when operating with client
safe mode, a check result will be published to report the
missing check definition. A check request without a
command indicates a check extension run. The check request may
contain `:extension`, the name of the extension to run. If
`:extension` is not present, the check name is used for the
extension name. If a check extension does not exist for a
name, a check result will be published to report the unknown
check extension.
Process a check request . If a check request has a check command it will be executed . A standard check request will be merged with a local check definition if present . Client safe mode is enforced in this method requiring a local check definition in order to execute the check command . If a local check definition does not exist when operating with client safe mode a check result will be published to report the missing check definition . A check request without a command indicates a check extension run . The check request may contain ` : extension ` the name of the extension to run . If ` : extension ` is not present the check name is used for the extension name . If a check extension does not exist for a name a check result will be published to report the unknown check extension .
def process_check_request(check)
        @logger.debug("processing check", :check => check)
        if @settings.check_exists?(check[:name]) && !check.has_key?(:proxy_requests)
          check.merge!(@settings[:checks][check[:name]])
        end
        if check.has_key?(:command)
          if @safe_mode && !@settings.check_exists?(check[:name])
            check[:output] = "Check is not locally defined (safe mode)"
            check[:status] = 3
            check[:handle] = false
            check[:executed] = Time.now.to_i
            publish_check_result(check)
          else
            execute_check_command(check)
          end
        else
          extension_name = check[:extension] || check[:name]
          if @extensions.check_exists?(extension_name)
            run_check_extension(check)
          else
            @logger.warn("unknown check extension", :check => check)
          end
        end
      end
def process_check_request ( check ) @logger . debug ( "processing check" , :check => check ) if @settings . check_exists? ( check [ :name ] ) && ! check . has_key? ( :proxy_requests ) check . merge! ( @settings [ :checks ] [ check [ :name ] ] ) end if check . has_key? ( :command ) if @safe_mode && ! @settings . check_exists? ( check [ :name ] ) check [ :output ] = "Check is not locally defined (safe mode)" check [ :status ] = 3 check [ :handle ] = false check [ :executed ] = Time . now . to_i publish_check_result ( check ) else execute_check_command ( check ) end else extension_name = check [ :extension ] || check [ :name ] if @extensions . check_exists? ( extension_name ) run_check_extension ( check ) else @logger . warn ( "unknown check extension" , :check => check ) end end end
Process a check request.
Process a check request .
check
None