lib/sensu/api/utilities/publish_check_request.rb
def publish_check_request(check)
          payload = check.reject do |key, value|
            [:subscribers, :interval].include?(key)
          end
          payload[:issued] = Time.now.to_i
          @logger.info("publishing check request", {
            :payload => payload,
            :subscribers => check[:subscribers]
          })
          check[:subscribers].each do |subscription|
            options = transport_publish_options(subscription.to_s, Sensu::JSON.dump(payload))
            @transport.publish(*options) do |info|
              if info[:error]
                @logger.error("failed to publish check request", {
                  :subscription => subscription,
                  :payload => payload,
                  :error => info[:error].to_s
                })
              end
            end
          end
        end
# Publish a check request to the Transport. A check request is
# composed of a check `:name`, an `:issued` timestamp, a check
# `:command` if available, and a check `:extension if available.
# The check request is published to a Transport pipe, for each
# of the check `:subscribers` in its definition, eg. "webserver".
# JSON serialization is used when publishing the check request
# payload to the Transport pipes. Transport errors are logged.
#
# @param check [Hash] definition.
Publish a check request to the Transport.
Publish a check request to the Transport .
def publish_check_request(check)
          payload = check.reject do |key, value|
            [:subscribers, :interval].include?(key)
          end
          payload[:issued] = Time.now.to_i
          @logger.info("publishing check request", {
            :payload => payload,
            :subscribers => check[:subscribers]
          })
          check[:subscribers].each do |subscription|
            options = transport_publish_options(subscription.to_s, Sensu::JSON.dump(payload))
            @transport.publish(*options) do |info|
              if info[:error]
                @logger.error("failed to publish check request", {
                  :subscription => subscription,
                  :payload => payload,
                  :error => info[:error].to_s
                })
              end
            end
          end
        end
def publish_check_request ( check ) payload = check . reject do | key , value | [ :subscribers , :interval ] . include? ( key ) end payload [ :issued ] = Time . now . to_i @logger . info ( "publishing check request" , { :payload => payload , :subscribers => check [ :subscribers ] } ) check [ :subscribers ] . each do | subscription | options = transport_publish_options ( subscription . to_s , Sensu :: JSON . dump ( payload ) ) @transport . publish ( * options ) do | info | if info [ :error ] @logger . error ( "failed to publish check request" , { :subscription => subscription , :payload => payload , :error => info [ :error ] . to_s } ) end end end end
Publish a check request to the Transport.
Publish a check request to the Transport .
check
None