elastic_board 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -2
- data/config.ru +1 -1
- data/lib/elastic_board.rb +6 -3
- data/lib/elastic_board/summary.rb +8 -0
- data/lib/elastic_board/version.rb +1 -1
- data/lib/elastic_board/views/down.erb +48 -0
- data/lib/elastic_board/views/index.erb +2 -2
- metadata +3 -2
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Load it in your `config.ru` file with an instance of `ElasticSearch::Client`
|
|
24
24
|
|
25
25
|
map '/elasticboard' do
|
26
26
|
run ElasticBoard::Application.new(
|
27
|
-
:connection => ElasticSearch.new("localhost:9200")
|
27
|
+
:connection => (ElasticSearch.new("localhost:9200") rescue nil)
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
@@ -32,12 +32,14 @@ If you use something like Escargot and ActiveRecord in your application, you can
|
|
32
32
|
|
33
33
|
map '/elasticboard' do
|
34
34
|
run ElasticBoard::Application.new(
|
35
|
-
:connection => Escargot.connection
|
35
|
+
:connection => (Escargot.connection rescue nil)
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
39
|
From there, just go to `/elasticboard` and check it out.
|
40
40
|
|
41
|
+
Note: `rescue nil` is a nice safety in the event that your app is unable to connect to ElasticSearch, it will still boot. If you don't leave ES running on your development machine, this will let your app continue to boot regardless of whether or not ES is running. ElasticBoard will handle a nil connection gracefully.
|
42
|
+
|
41
43
|
## Contributing
|
42
44
|
|
43
45
|
1. Fork it
|
data/config.ru
CHANGED
data/lib/elastic_board.rb
CHANGED
@@ -57,9 +57,12 @@ module ElasticBoard
|
|
57
57
|
# ==================
|
58
58
|
|
59
59
|
get '/' do
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
if self.connection
|
61
|
+
@summary = ElasticBoard::Summary.new(self.connection)
|
62
|
+
erb :index
|
63
|
+
else
|
64
|
+
erb :down
|
65
|
+
end
|
63
66
|
end
|
64
67
|
|
65
68
|
end
|
@@ -87,6 +87,14 @@ module ElasticBoard
|
|
87
87
|
cluster_health['unassigned_shards']
|
88
88
|
end
|
89
89
|
|
90
|
+
def cluster_health_notice
|
91
|
+
if unassigned_shards.to_i > 0
|
92
|
+
"Unassigned Shards Greater than Zero"
|
93
|
+
else
|
94
|
+
return nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
90
98
|
private
|
91
99
|
|
92
100
|
def extract_ip_from_address(address)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
2
|
+
<div class="navbar-inner">
|
3
|
+
<div class="container">
|
4
|
+
<a class="brand" href="#">ElasticBoard</a>
|
5
|
+
<span class="badge badge-important" style="margin-top:11px;">Unable to Connect to ElasticSearch</span>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="container">
|
11
|
+
|
12
|
+
<!-- Example row of columns -->
|
13
|
+
<div class="row">
|
14
|
+
<div class="span6">
|
15
|
+
<h2>Cluster Health <span class="badge badge-important">Down</span></h2>
|
16
|
+
<div class="well well-top">
|
17
|
+
<table class="summary_table">
|
18
|
+
<tr><td style="font-weight: bold">Number of Nodes</td><td>0</td></tr>
|
19
|
+
<tr><td style="font-weight: bold">Active Shards</td><td>0</td></tr>
|
20
|
+
<tr><td style="font-weight: bold">Active Primary Shards</td><td>0</td></tr>
|
21
|
+
<tr><td style="font-weight: bold">Unassigned Shards</td><td>0</td></tr>
|
22
|
+
</table>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<div class="span6">
|
26
|
+
<h2>Nodes in Cluster</h2>
|
27
|
+
<div class="well well-top">
|
28
|
+
<table class="summary_table">
|
29
|
+
</table>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<!-- Main hero unit for a primary marketing message or call to action -->
|
35
|
+
<div class="container">
|
36
|
+
<h2>Indexes</h2>
|
37
|
+
<div class="well">
|
38
|
+
<h2>Unable to connect to ElasticSearch</h2>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<hr>
|
43
|
+
|
44
|
+
<footer>
|
45
|
+
<p>© ElasticBoard 2013</p>
|
46
|
+
</footer>
|
47
|
+
|
48
|
+
</div>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<!-- Example row of columns -->
|
13
13
|
<div class="row">
|
14
14
|
<div class="span6">
|
15
|
-
<h2>Cluster Health <span class="badge badge-<%= @summary.
|
15
|
+
<h2>Cluster Health <span class="badge badge-<%= @summary.cluster_health_notice.nil? ? 'success' : 'warning' %>"><%= @summary.cluster_health_notice.nil? ? 'Healthy' : @summary.cluster_health_notice %></span></h2>
|
16
16
|
<div class="well well-top">
|
17
17
|
<table class="summary_table">
|
18
18
|
<tr><td style="font-weight: bold">Number of Nodes</td><td><%= @summary.number_of_nodes %></td></tr>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
</div>
|
24
24
|
</div>
|
25
25
|
<div class="span6">
|
26
|
-
<h2>Nodes in Cluster
|
26
|
+
<h2>Nodes in Cluster <span class="badge badge-<%= @summary.nodes_info['ok'] ? 'success' : 'important' %>"><%= @summary.nodes_info['ok'] ? 'Healthy' : 'Problem' %></span></h2>
|
27
27
|
<div class="well well-top">
|
28
28
|
<table class="summary_table">
|
29
29
|
<% @summary.nodes.each do |node| %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_board
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/elastic_board/public/js/bootstrap.min.js
|
83
83
|
- lib/elastic_board/summary.rb
|
84
84
|
- lib/elastic_board/version.rb
|
85
|
+
- lib/elastic_board/views/down.erb
|
85
86
|
- lib/elastic_board/views/index.erb
|
86
87
|
- lib/elastic_board/views/layout.erb
|
87
88
|
homepage: ''
|