lib/sensu/client/process.rb
# Publish a check result to the transport for processing. A
# check result is composed of a client (name) and a check
# definition, containing check `:output` and `:status`. JSON
# serialization is used when publishing the check result payload
# to the transport pipe. The check result is signed with the
# client signature if configured, for source validation.
# Transport errors are logged.
#
# @param check [Hash]
Publish a check result to the transport for processing. A
check result is composed of a client (name) and a check
definition, containing check `:output` and `:status`. JSON
serialization is used when publishing the check result payload
to the transport pipe. The check result is signed with the
client signature if configured, for source validation.
Transport errors are logged.
Publish a check result to the transport for processing . A check result is composed of a client ( name ) and a check definition containing check ` : output ` and ` : status ` . JSON serialization is used when publishing the check result payload to the transport pipe . The check result is signed with the client signature if configured for source validation . Transport errors are logged .
def publish_check_result(check)
        check.delete(:source) if check[:source] == ""
        payload = {
          :client => @settings[:client][:name],
          :check => check
        }
        payload[:signature] = @settings[:client][:signature] if @settings[:client][:signature]
        @logger.info("publishing check result", :payload => payload)
        @transport.publish(:direct, "results", Sensu::JSON.dump(payload)) do |info|
          if info[:error]
            @logger.error("failed to publish check result", {
              :payload => payload,
              :error => info[:error].to_s
            })
          end
        end
      end
def publish_check_result ( check ) check . delete ( :source ) if check [ :source ] == "" payload = { :client => @settings [ :client ] [ :name ] , :check => check } payload [ :signature ] = @settings [ :client ] [ :signature ] if @settings [ :client ] [ :signature ] @logger . info ( "publishing check result" , :payload => payload ) @transport . publish ( :direct , "results" , Sensu :: JSON . dump ( payload ) ) do | info | if info [ :error ] @logger . error ( "failed to publish check result" , { :payload => payload , :error => info [ :error ] . to_s } ) end end end
Publish a check result to the transport for processing.
Publish a check result to the transport for processing .
check
None