kibana-rack 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/README.md +12 -5
- data/lib/kibana/rack.rb +20 -2
- data/lib/kibana/rack/version.rb +1 -1
- data/lib/kibana/rack/web.rb +7 -6
- data/spec/fixtures/dashboards/{templated.json → erb_dashboard.json} +0 -0
- data/spec/fixtures/dashboards/js_dashboard.js +5 -0
- data/spec/fixtures/dashboards/json_dashboard.json +3 -0
- data/spec/unit/kibana/rack/web_spec.rb +14 -5
- metadata +8 -6
- metadata.gz.sig +0 -0
- data/spec/fixtures/dashboards/default.json +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a7837cd69c73cf1ea3684d8c6aabfac206bfc0
|
4
|
+
data.tar.gz: 8f9eea65186608e7de897872c231e2b628dc353d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e6aba3b62820eac07a0bd572cd8fd4654cbccb1665723022f43b71bcd54ade4805e27af7a151858b785d7dc85de60536850d27f47b391e41de91e0e9bd7377a
|
7
|
+
data.tar.gz: 6dd53e6cffdc5f291bee6a8c56ef43634430b949363860597c54031d73f76e1ea1fb63c9d810d23bd30ba739996dd0fe551f7237e57628d496607db7b83c0c01
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change history for kibana-rack
|
2
2
|
|
3
|
+
## [v0.1.1](https://github.com/tabolario/kibana-rack/releases/tag/v0.1.1)
|
4
|
+
|
5
|
+
* [Bug] [Support scripted dashboard endpoint (/dashboard/script/*.js)](https://github.com/tabolario/kibana-rack/issues/8)
|
6
|
+
* [Bug] [Dashboard endpoint should return correct content type](https://github.com/tabolario/kibana-rack/issues/2)
|
7
|
+
|
3
8
|
## [v0.1.0](https://github.com/tabolario/kibana-rack/releases/tag/v0.1.0)
|
4
9
|
|
5
10
|
* Initial release
|
data/README.md
CHANGED
@@ -9,16 +9,25 @@
|
|
9
9
|
|
10
10
|
Embed [Kibana](http://www.elasticsearch.org/overview/kibana/) as a [Rack](http://rack.github.io/) application.
|
11
11
|
|
12
|
-
|
12
|
+
From the [Kibana readme](https://github.com/elasticsearch/kibana/blob/master/README.md):
|
13
|
+
|
14
|
+
> Kibana is an open source (Apache Licensed), browser based analytics and search interface to Logstash and other timestamped data sets stored in ElasticSearch. With those in place Kibana is a snap to setup and start using (seriously). Kibana strives to be easy to get started with, while also being flexible and powerful
|
13
15
|
|
14
16
|
kibana-rack tracks the latest version of Kibana (currently 3.1.0) and embeds it directly in your application, along with a proxy for the Elasticsearch API endpoints that Kibana needs.
|
15
17
|
|
16
|
-
Kibana dashboards can be created using ERB-processed JSON files in the directory specified by your kibana-rack configuration.
|
18
|
+
[Kibana dashboards](http://www.elasticsearch.org/guide/en/kibana/current/_dashboard_schema.html) can be created using ERB-processed JSON files in the directory specified by your kibana-rack configuration.
|
17
19
|
|
18
20
|
## Requirements
|
19
21
|
|
20
22
|
* Ruby 2.1+ (kibana-rack is developed and tested with Ruby 2.1.2)
|
21
23
|
|
24
|
+
### Kibana requirements (also from the Kibana readme)
|
25
|
+
|
26
|
+
* Elasticsearch 0.90.9 or above
|
27
|
+
* A modern web browser. The latest version of Chrome, Safari and Firefox have all been tested to work. IE9 and greater should work. IE8 does not.
|
28
|
+
* A webserver. No extensions are required, as long as it can serve plain html it will work
|
29
|
+
* A browser reachable Elasticsearch server. Port 9200 must be open, or a proxy configured to allow access to it. (**kibana-rack takes care of this for you!**)
|
30
|
+
|
22
31
|
## Installation
|
23
32
|
|
24
33
|
Add this line to your application's Gemfile:
|
@@ -224,9 +233,7 @@ When a new **Major** version is made, a corresponding branch will be created nam
|
|
224
233
|
|
225
234
|
## Todo
|
226
235
|
|
227
|
-
|
228
|
-
* A Ruby DSL for defining dashboards
|
229
|
-
* Example dashboards for common use cases
|
236
|
+
See the [issue tracker](https://github.com/tabolario/kibana-rack/issues?q=is%3Aopen+is%3Aissue+label%3Atodo) for the current list of todos.
|
230
237
|
|
231
238
|
## License
|
232
239
|
|
data/lib/kibana/rack.rb
CHANGED
@@ -13,9 +13,27 @@ module Kibana
|
|
13
13
|
DEFAULT_KIBANA_INDEX = 'kibana-int'
|
14
14
|
|
15
15
|
class << self
|
16
|
-
|
17
|
-
|
16
|
+
# The hostname of the Elasticsearch instance to proxy to.
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :elasticsearch_host
|
18
19
|
|
20
|
+
# The port of the Elasticsearch instance to proxy to.
|
21
|
+
# @return [Fixnum]
|
22
|
+
attr_accessor :elasticsearch_port
|
23
|
+
|
24
|
+
# The filesystem path to look for Kibana dashboards.
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :kibana_dashboards_path
|
27
|
+
|
28
|
+
# The default client-side location that Kibana navigates to.
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :kibana_default_route
|
31
|
+
|
32
|
+
# The name of the internal Elasticsearch index Kibana uses to store metadata and dashboards.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :kibana_index
|
35
|
+
|
36
|
+
# Yields the {Kibana} module to allow configuration of global settings.
|
19
37
|
def configure(&block)
|
20
38
|
block.call(self)
|
21
39
|
end
|
data/lib/kibana/rack/version.rb
CHANGED
data/lib/kibana/rack/web.rb
CHANGED
@@ -2,8 +2,6 @@ module Kibana
|
|
2
2
|
module Rack
|
3
3
|
# Rack application that serves Kibana and proxies requests to Elasticsearch
|
4
4
|
class Web < Sinatra::Base
|
5
|
-
VERSION = '0.1.0'
|
6
|
-
|
7
5
|
register Sinatra::MultiRoute
|
8
6
|
|
9
7
|
set :root, File.expand_path('../../../../web', __FILE__)
|
@@ -33,12 +31,15 @@ module Kibana
|
|
33
31
|
erb :config
|
34
32
|
end
|
35
33
|
|
36
|
-
get(%r{/app/
|
37
|
-
|
38
|
-
|
34
|
+
get(%r{/app/dashboard/(file|script)/([\w-]+)\.(js(on)?)}) do
|
35
|
+
dashboard_name = params[:captures][1]
|
36
|
+
dashboard_ext = params[:captures][2]
|
37
|
+
dashboard_path = File.join(settings.kibana_dashboards_path, "#{dashboard_name}.#{dashboard_ext}")
|
38
|
+
|
39
39
|
halt(404, { 'Content-Type' => 'application/json' }, '{"error":"Not found"}') unless File.exist?(dashboard_path)
|
40
|
+
|
40
41
|
template = IO.read(dashboard_path)
|
41
|
-
content_type
|
42
|
+
content_type "application/#{dashboard_ext}"
|
42
43
|
erb template
|
43
44
|
end
|
44
45
|
|
File without changes
|
@@ -23,22 +23,31 @@ describe Kibana::Rack::Web do
|
|
23
23
|
expect(last_response.status).to eql(200)
|
24
24
|
end
|
25
25
|
|
26
|
-
it 'renders dashboards from the dashboard directory' do
|
27
|
-
get '/app/
|
26
|
+
it 'renders JavaScript dashboards from the dashboard directory' do
|
27
|
+
get '/app/dashboard/script/js_dashboard.js'
|
28
28
|
|
29
|
-
expect(last_response.body).to eql(IO.read(File.join(dashboards_path, '
|
29
|
+
expect(last_response.body).to eql(IO.read(File.join(dashboards_path, 'js_dashboard.js')))
|
30
|
+
expect(last_response['Content-Type']).to eql('application/js')
|
31
|
+
expect(last_response.status).to eql(200)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'renders JSON dashboards from the dashboard directory' do
|
35
|
+
get '/app/dashboard/file/json_dashboard.json'
|
36
|
+
|
37
|
+
expect(last_response.body).to eql(IO.read(File.join(dashboards_path, 'json_dashboard.json')))
|
38
|
+
expect(last_response['Content-Type']).to eql('application/json')
|
30
39
|
expect(last_response.status).to eql(200)
|
31
40
|
end
|
32
41
|
|
33
42
|
it 'processes ERB in dashboards' do
|
34
43
|
ENV['DASHBOARD_TITLE'] = 'My Dashboard'
|
35
|
-
get '/app/
|
44
|
+
get '/app/dashboard/file/erb_dashboard.json'
|
36
45
|
|
37
46
|
expect(last_response.body.strip).to eql('{"title":"My Dashboard"}')
|
38
47
|
end
|
39
48
|
|
40
49
|
it 'returns 404 if a dashboard does not exist' do
|
41
|
-
get '/app/
|
50
|
+
get '/app/dashboard/file/nonexistent.json'
|
42
51
|
|
43
52
|
expect(last_response.body.strip).to eql('{"error":"Not found"}')
|
44
53
|
expect(last_response.status).to eql(404)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kibana-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Burns
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
WdK2SktNC0LYNRz+x3DdkcnVGS5BbSE7CYk7ap0J9jTobkmBTZ6tNWhVQiy7eJLr
|
31
31
|
pOgabsoLeT6zXAW+EOudMh1S/ZA=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-08-
|
33
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: faraday
|
@@ -151,8 +151,9 @@ files:
|
|
151
151
|
- lib/kibana/rack.rb
|
152
152
|
- lib/kibana/rack/version.rb
|
153
153
|
- lib/kibana/rack/web.rb
|
154
|
-
- spec/fixtures/dashboards/
|
155
|
-
- spec/fixtures/dashboards/
|
154
|
+
- spec/fixtures/dashboards/erb_dashboard.json
|
155
|
+
- spec/fixtures/dashboards/js_dashboard.js
|
156
|
+
- spec/fixtures/dashboards/json_dashboard.json
|
156
157
|
- spec/spec_helper.rb
|
157
158
|
- spec/unit/kibana/rack/web_spec.rb
|
158
159
|
- spec/unit/kibana/rack_spec.rb
|
@@ -328,8 +329,9 @@ signing_key:
|
|
328
329
|
specification_version: 4
|
329
330
|
summary: Embed Kibana as a Rack application
|
330
331
|
test_files:
|
331
|
-
- spec/fixtures/dashboards/
|
332
|
-
- spec/fixtures/dashboards/
|
332
|
+
- spec/fixtures/dashboards/erb_dashboard.json
|
333
|
+
- spec/fixtures/dashboards/js_dashboard.js
|
334
|
+
- spec/fixtures/dashboards/json_dashboard.json
|
333
335
|
- spec/spec_helper.rb
|
334
336
|
- spec/unit/kibana/rack/web_spec.rb
|
335
337
|
- spec/unit/kibana/rack_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,90 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"title": "Introduction",
|
3
|
-
"services": {
|
4
|
-
"query": {
|
5
|
-
"list": {
|
6
|
-
"0": {
|
7
|
-
"query": "*",
|
8
|
-
"alias": "",
|
9
|
-
"color": "#7EB26D",
|
10
|
-
"id": 0,
|
11
|
-
"pin": false,
|
12
|
-
"type": "lucene"
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"ids": [
|
16
|
-
0
|
17
|
-
]
|
18
|
-
},
|
19
|
-
"filter": {
|
20
|
-
"list": {},
|
21
|
-
"ids": []
|
22
|
-
}
|
23
|
-
},
|
24
|
-
"rows": [
|
25
|
-
{
|
26
|
-
"title": "Intro",
|
27
|
-
"height": "450px",
|
28
|
-
"editable": false,
|
29
|
-
"collapse": false,
|
30
|
-
"collapsable": false,
|
31
|
-
"panels": [
|
32
|
-
{
|
33
|
-
"error": false,
|
34
|
-
"span": 4,
|
35
|
-
"editable": false,
|
36
|
-
"group": [
|
37
|
-
"default"
|
38
|
-
],
|
39
|
-
"type": "text",
|
40
|
-
"mode": "markdown",
|
41
|
-
"content": "![kibana](img/kibana.png) \n\n##### Did you just upgrade? Not expecting this screen?\nIf you were using the old default page you might not be expecting this screen. I understand, change can be awkward. Let me explain. \n\n##### Setting a global default dashboard\nKibana has always shipped with an interface for Logstash, still does! You can access it [here](index.html#dashboard/file/logstash.json). However, if you want to make it your default again, all you need to do is rename a file!\nIn your Kibana installation directory: \n\nRename *logstash.json* to *default.json* and refresh. Should be all set.\n\n##### But wait, there's more!\nIn fact, you can add any exported dashboard to that directory and access it as *http://YOUR-HOST -HERE/index.html#dashboard/file/YOUR-DASHBOARD.json*. Neat trick eh?",
|
42
|
-
"style": {},
|
43
|
-
"title": "",
|
44
|
-
"status": "Stable"
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"error": false,
|
48
|
-
"span": 8,
|
49
|
-
"editable": false,
|
50
|
-
"group": [
|
51
|
-
"default"
|
52
|
-
],
|
53
|
-
"type": "text",
|
54
|
-
"mode": "markdown",
|
55
|
-
"content": "### Welcome to Kibana. \nGlad you could make it. Happy to have you here! Lets get started, shall we?\n##### Requirements\n* **A good browser.** \n The latest version of Chrome or Firefox is recommended. Safari (latest version) and Internet Explorer 9 and above are also supported.\n* **A webserver.** \n Just somewhere to host the HTML and Javascript. Basically any webserver will work.\n* **Elasticsearch** \n 0.90.9 or above. \n\n##### Configuration\nIf Kibana and Elasticsearch are on the same host, and you're using the default Elasticsearch port, then you're all set. Kibana is configured to use that setup by default! \n\nIf not, you need to edit *config.js* and set the *elasticsearch* parameter with the URL (including port, probably 9200) of your Elasticsearch server. The host part should be the entire, fully qualified domain name, or IP, **not localhost**.\n#### Are you a Logstash User?\n+ **YES** - Great! We have a prebuilt dashboard: [(Logstash Dashboard)](index.html#/dashboard/file/logstash.json). See the note to the right about making it your global default \n\n+ **NO** - Hey, no problem, you just have a bit of setup to do. You have a few choices: \n\n 1. [Sample Dashboard](index.html#/dashboard/file/guided.json) *I don't have much data yet, please extract some basics for me* \n 2. [Unconfigured Dashboard](index.html#/dashboard/file/noted.json) *I have a lot of data and I don't want Kibana to query it at once*\n 3. [Blank Dashboard](index.html#/dashboard/file/blank.json) *I'm comfortable figuring it out on my own*",
|
56
|
-
"style": {},
|
57
|
-
"status": "Stable"
|
58
|
-
}
|
59
|
-
],
|
60
|
-
"notice": false
|
61
|
-
}
|
62
|
-
],
|
63
|
-
"editable": false,
|
64
|
-
"index": {
|
65
|
-
"interval": "none",
|
66
|
-
"pattern": "[logstash-]YYYY.MM.DD",
|
67
|
-
"default": "_all",
|
68
|
-
"warm_fields": false
|
69
|
-
},
|
70
|
-
"style": "dark",
|
71
|
-
"failover": false,
|
72
|
-
"panel_hints": true,
|
73
|
-
"pulldowns": [],
|
74
|
-
"nav": [],
|
75
|
-
"loader": {
|
76
|
-
"save_gist": false,
|
77
|
-
"save_elasticsearch": true,
|
78
|
-
"save_local": true,
|
79
|
-
"save_default": true,
|
80
|
-
"save_temp": true,
|
81
|
-
"save_temp_ttl_enable": true,
|
82
|
-
"save_temp_ttl": "30d",
|
83
|
-
"load_gist": true,
|
84
|
-
"load_elasticsearch": true,
|
85
|
-
"load_elasticsearch_size": 20,
|
86
|
-
"load_local": true,
|
87
|
-
"hide": false
|
88
|
-
},
|
89
|
-
"refresh": false
|
90
|
-
}
|