lib/sensu/client/socket.rb
def process_data(data)
        if data.strip == PING_REQUEST
          @logger.debug("socket received ping")
          respond("pong")
        else
          @logger.debug("socket received data", :data => data)
          unless valid_utf8?(data)
            @logger.warn("data from socket is not a valid UTF-8 sequence, processing it anyways", :data => data)
          end
          begin
            parse_check_result(data)
          rescue => error
            @logger.error("failed to process check result from socket", {
              :data => data,
              :error => error.to_s
            })
            respond("invalid")
          end
        end
      end
# Process the data received. This method validates the data
# encoding, provides ping/pong functionality, and passes potential
# check results on for further processing.
#
# @param [String] data to be processed.
Process the data received. This method validates the data
encoding, provides ping/pong functionality, and passes potential
check results on for further processing.
Process the data received . This method validates the data encoding provides ping / pong functionality and passes potential check results on for further processing .
def process_data(data)
        if data.strip == PING_REQUEST
          @logger.debug("socket received ping")
          respond("pong")
        else
          @logger.debug("socket received data", :data => data)
          unless valid_utf8?(data)
            @logger.warn("data from socket is not a valid UTF-8 sequence, processing it anyways", :data => data)
          end
          begin
            parse_check_result(data)
          rescue => error
            @logger.error("failed to process check result from socket", {
              :data => data,
              :error => error.to_s
            })
            respond("invalid")
          end
        end
      end
def process_data ( data ) if data . strip == PING_REQUEST @logger . debug ( "socket received ping" ) respond ( "pong" ) else @logger . debug ( "socket received data" , :data => data ) unless valid_utf8? ( data ) @logger . warn ( "data from socket is not a valid UTF-8 sequence, processing it anyways" , :data => data ) end begin parse_check_result ( data ) rescue => error @logger . error ( "failed to process check result from socket" , { :data => data , :error => error . to_s } ) respond ( "invalid" ) end end end
Process the data received.
Process the data received .
data
data to be processed.
data to be processed .