Chapter 09/circuit-oneops-1-master/components/cookbooks/diagnostic_cache/files/default/couchbase_monitor.rb
#Opens tcp sockets to all graphite servers on the specified port#
Opens tcp sockets to all graphite servers on the specified port
Opens tcp sockets to all graphite servers on the specified port
def open_tcp_sockets()
    logger.info "open_tcp_sockets:start: graphite host list = #{@graphite_hosts}"
    if (@graphite_hosts.length > 0)
      @tcp_sockets = Array.new
      graphite_hosts.each do |graphite_host|
        begin
          graphite_server = graphite_host.split(':')[0]
          port = graphite_host.split(':')[1]
          tcp_socket = TCPSocket.new(graphite_server, port)
          @tcp_sockets.insert(-1, tcp_socket)
        rescue Exception => e
          logger.error "open_tcp_sockets:exception: graphite host = #{graphite_host} #{e}"
        end
      end
    end
    logger.info 'open_tcp_sockets:end: Completed'
  end
def open_tcp_sockets ( ) logger . info "open_tcp_sockets:start: graphite host list = #{@graphite_hosts}" if ( @graphite_hosts . length > 0 ) @tcp_sockets = Array . new graphite_hosts . each do | graphite_host | begin graphite_server = graphite_host . split ( ':' ) [ 0 ] port = graphite_host . split ( ':' ) [ 1 ] tcp_socket = TCPSocket . new ( graphite_server , port ) @tcp_sockets . insert ( - 1 , tcp_socket ) rescue Exception => e logger . error "open_tcp_sockets:exception: graphite host = #{graphite_host} #{e}" end end end logger . info 'open_tcp_sockets:end: Completed' end
Opens tcp sockets to all graphite servers on the specified port
Opens tcp sockets to all graphite servers on the specified port