lib/sensu/server/handle.rb
# Execute a pipe event handler, using the defined handler
# command to spawn a process, passing it event data via STDIN.
# Log the handler output lines and decrement the
# `@in_progress[:events]` by `1` when the handler executes
# successfully.
#
# When the spawned process exits with status 0, its output is
# logged at :info level. Otherwise, its output is logged at
# :error level.
#
# @param handler [Hash] definition.
# @param event_data [Object] provided to the spawned handler
#   process via STDIN.
# @param event_id [String] event UUID
Execute a pipe event handler, using the defined handler
command to spawn a process, passing it event data via STDIN.
Log the handler output lines and decrement the
`@in_progress[:events]` by `1` when the handler executes
successfully.

When the spawned process exits with status 0, its output is
logged at :info level. Otherwise, its output is logged at
:error level.
Execute a pipe event handler using the defined handler command to spawn a process passing it event data via STDIN . Log the handler output lines and decrement the ` @in_progress [ : events ] ` by ` 1 ` when the handler executes successfully . When the spawned process exits with status 0 its output is logged at : info level . Otherwise its output is logged at : error level .
def pipe_handler(handler, event_data, event_id)
        options = {:data => event_data, :timeout => handler[:timeout]}
        Spawn.process(handler[:command], options) do |output, status|
          log_level = status == 0 ? :info : :error
          @logger.send(log_level, "handler output", {
            :handler => handler,
            :event => {
              :id => event_id
            },
            :output => output.split("\n+")
          })
          @in_progress[:events] -= 1 if @in_progress
        end
      end
def pipe_handler ( handler , event_data , event_id ) options = { :data => event_data , :timeout => handler [ :timeout ] } Spawn . process ( handler [ :command ] , options ) do | output , status | log_level = status == 0 ? :info : :error @logger . send ( log_level , "handler output" , { :handler => handler , :event => { :id => event_id } , :output => output . split ( "\n+" ) } ) @in_progress [ :events ] -= 1 if @in_progress end end
Execute a pipe event handler, using the defined handler
command to spawn a process, passing it event data via STDIN.
Execute a pipe event handler using the defined handler command to spawn a process passing it event data via STDIN .
handler
None
event_data
provided to the spawned handler process via STDIN.
provided to the spawned handler process via STDIN .
event_id
None