lib/sensu/client/utils.rb
# Publish a check result to the Sensu transport.
#
# @param [Hash] check result.
Publish a check result to the Sensu transport.
Publish a check result to the Sensu transport .
def publish_check_result(check)
        payload = {
          :client => @settings[:client][:name],
          :check => check.merge(:issued => Time.now.to_i)
        }
        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 ) payload = { :client => @settings [ :client ] [ :name ] , :check => check . merge ( :issued => Time . now . to_i ) } 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 Sensu transport.
Publish a check result to the Sensu transport .
check
None