Chapter 09/circuit-oneops-1-master/components/cookbooks/diagnostic_cache/files/default/couchbase_monitor.rb
#Iterates through a list of graphite hosts, opens up a TCP connection and
#writes the metrics out to the graphite server
Iterates through a list of graphite hosts, opens up a TCP connection and
writes the metrics out to the graphite server
Iterates through a list of graphite hosts opens up a TCP connection and writes the metrics out to the graphite server
def write_to_graphite(key, value, time = Time.now)
    logger.info "write_to_graphite:start: key = #{key}, value = #{value}, time = #{time.to_i}"
    if (@tcp_sockets.length > 0)
      @tcp_sockets.each do |tcp_socket|
        begin
          tcp_socket.write("#{key} #{value.to_f} #{time.to_i}\n")
        rescue Exception => e
          logger.error "write_to_graphite:exception: #{e}"
        end
      end
    end
    logger.info 'write_to_graphite:end: Completed'
  end
def write_to_graphite ( key , value , time = Time . now ) logger . info "write_to_graphite:start: key = #{key}, value = #{value}, time = #{time.to_i}" if ( @tcp_sockets . length > 0 ) @tcp_sockets . each do | tcp_socket | begin tcp_socket . write ( "#{key} #{value.to_f} #{time.to_i}\n" ) rescue Exception => e logger . error "write_to_graphite:exception: #{e}" end end end logger . info 'write_to_graphite:end: Completed' end
Iterates through a list of graphite hosts, opens up a TCP connection and
writes the metrics out to the graphite server
Iterates through a list of graphite hosts opens up a TCP connection and writes the metrics out to the graphite server
#puts key, value, time.to_i
key
<not_specific>
value
<not_specific>
time
<not_specific>
now
<not_specific>