Class: ElasticBoard::Summary
- Inherits:
-
Object
- Object
- ElasticBoard::Summary
- Defined in:
- lib/elastic_board/summary.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
- #active_primary_shards ⇒ Object
- #active_shards ⇒ Object
-
#cluster_health ⇒ Object
= Health Functions = ====================.
- #cluster_health_notice ⇒ Object
- #cluster_name ⇒ Object
-
#cluster_state ⇒ Object
= State Functions = ===================.
- #cluster_status ⇒ Object
-
#index_status ⇒ Object
= Index Functions = ===================.
- #indices ⇒ Object
-
#initialize(*servers) ⇒ Summary
constructor
A new instance of Summary.
- #nodes ⇒ Object
-
#nodes_info ⇒ Object
= Node Functions = ==================.
- #number_of_nodes ⇒ Object
- #unassigned_shards ⇒ Object
Constructor Details
#initialize(*servers) ⇒ Summary
Returns a new instance of Summary.
6 7 8 9 10 11 12 |
# File 'lib/elastic_board/summary.rb', line 6 def initialize(*servers) if servers.first.is_a?(ElasticSearch::Client) self.connection = servers.first else self.connection = ElasticSearch.new(servers) end end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/elastic_board/summary.rb', line 4 def connection @connection end |
Instance Method Details
#active_primary_shards ⇒ Object
78 79 80 |
# File 'lib/elastic_board/summary.rb', line 78 def active_primary_shards cluster_health['active_primary_shards'] end |
#active_shards ⇒ Object
74 75 76 |
# File 'lib/elastic_board/summary.rb', line 74 def active_shards cluster_health['active_shards'] end |
#cluster_health ⇒ Object
Health Functions =
58 59 60 |
# File 'lib/elastic_board/summary.rb', line 58 def cluster_health @cluster_health ||= self.connection.cluster_health end |
#cluster_health_notice ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/elastic_board/summary.rb', line 90 def cluster_health_notice if unassigned_shards.to_i > 0 "Unassigned Shards Greater than Zero" else return nil end end |
#cluster_name ⇒ Object
62 63 64 |
# File 'lib/elastic_board/summary.rb', line 62 def cluster_name cluster_health['cluster_name'] end |
#cluster_state ⇒ Object
State Functions =
18 19 20 |
# File 'lib/elastic_board/summary.rb', line 18 def cluster_state @cluster_state ||= self.connection.cluster_state end |
#cluster_status ⇒ Object
66 67 68 |
# File 'lib/elastic_board/summary.rb', line 66 def cluster_status cluster_health['status'] end |
#index_status ⇒ Object
Index Functions =
46 47 48 |
# File 'lib/elastic_board/summary.rb', line 46 def index_status @index_status ||= self.connection.index_status end |
#indices ⇒ Object
50 51 52 |
# File 'lib/elastic_board/summary.rb', line 50 def indices index_status['indices'] end |
#nodes ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/elastic_board/summary.rb', line 30 def nodes nodes = [ ] nodes_info['nodes'].each do |key, node_details| nodes << { :name => node_details['name'], :address => extract_ip_from_address(node_details['transport_address']) } end return nodes end |
#nodes_info ⇒ Object
Node Functions =
26 27 28 |
# File 'lib/elastic_board/summary.rb', line 26 def nodes_info @nodes_info ||= self.connection.nodes_info end |
#number_of_nodes ⇒ Object
70 71 72 |
# File 'lib/elastic_board/summary.rb', line 70 def number_of_nodes cluster_health['number_of_nodes'] end |
#unassigned_shards ⇒ Object
86 87 88 |
# File 'lib/elastic_board/summary.rb', line 86 def unassigned_shards cluster_health['unassigned_shards'] end |