elasticsearch-extensions/lib/elasticsearch/extensions/test/cluster.rb
# Print information about the cluster on STDOUT
#
# @api private
#
Print information about the cluster on STDOUT
Print information about the cluster on STDOUT
def __print_cluster_info(port)
          health = JSON.parse(Net::HTTP.get(URI("http://localhost:#{port}/_cluster/health")))
          nodes  = JSON.parse(Net::HTTP.get(URI("http://localhost:#{port}/_nodes/process,http")))
          master = JSON.parse(Net::HTTP.get(URI("http://localhost:#{port}/_cluster/state")))['master_node']
          puts "\n",
                ('-'*80).ansi(:faint),
               'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),
               'Status:  '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),
               'Nodes:   '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)
          nodes['nodes'].each do |id, info|
            m = id == master ? '+' : '-'
            puts ''.ljust(20) +
                 "#{m} #{info['name'].ansi(:bold)} | version: #{info['version']}, pid: #{info['process']['id']}, address: #{info['http']['bound_address']}".ansi(:faint)
          end
        end
def __print_cluster_info ( port ) health = JSON . parse ( Net :: HTTP . get ( URI ( "http://localhost:#{port}/_cluster/health" ) ) ) nodes = JSON . parse ( Net :: HTTP . get ( URI ( "http://localhost:#{port}/_nodes/process,http" ) ) ) master = JSON . parse ( Net :: HTTP . get ( URI ( "http://localhost:#{port}/_cluster/state" ) ) ) [ 'master_node' ] puts "\n" , ( '-' * 80 ) . ansi ( :faint ) , 'Cluster: ' . ljust ( 20 ) . ansi ( :faint ) + health [ 'cluster_name' ] . to_s . ansi ( :faint ) , 'Status:  ' . ljust ( 20 ) . ansi ( :faint ) + health [ 'status' ] . to_s . ansi ( :faint ) , 'Nodes:   ' . ljust ( 20 ) . ansi ( :faint ) + health [ 'number_of_nodes' ] . to_s . ansi ( :faint ) nodes [ 'nodes' ] . each do | id , info | m = id == master ? '+' : '-' puts '' . ljust ( 20 ) + "#{m} #{info['name'].ansi(:bold)} | version: #{info['version']}, pid: #{info['process']['id']}, address: #{info['http']['bound_address']}" . ansi ( :faint ) end end
Print information about the cluster on STDOUT
Print information about the cluster on STDOUT
port
api
None