Module: InternetBoxLogger::Tasks::Kibana

Defined in:
lib/tasks/kibana.rb

Instance Method Summary collapse

Instance Method Details

#deploy_reportsObject



26
27
28
29
30
31
32
# File 'lib/tasks/kibana.rb', line 26

def deploy_reports
  kibana_reports_source.each do |report_file|
    EasyAppHelper.puts_and_logs " - Installing '#{report_file}' to '#{kibana_dashboards_path}'"
    options = {}
    FileUtils.cp report_file, kibana_dashboards_path, options
  end
end

#kibana_dashboards_pathObject



10
11
12
# File 'lib/tasks/kibana.rb', line 10

def kibana_dashboards_path
  "#{kibana_path}/app/dashboards"
end

#kibana_infoObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/tasks/kibana.rb', line 40

def kibana_info
  if valid_kibana_path?(kibana_path)
    EasyAppHelper.puts_and_logs "A valid Kibana install has been found in #{kibana_path}"
  else
    raise "No Kibana installation found in '\#{kibana_path}'.\n  You may want to update 'kibana_path' in your config to be able to use the 'deploy' target.\n\n  If Kibana is not on the machine this gem is installed you may have to manually copy files located in:\n    - \#{ibl_gem_path}/config/kibana_reports\n  into your Kibana dashboards path:\n    - <place where your Kibana is installed>/app/dashboards\n\n"
  end
end

#kibana_pathObject



14
15
16
# File 'lib/tasks/kibana.rb', line 14

def kibana_path
  EasyAppHelper.config[:kibana_path]
end

#kibana_reports_sourceObject



5
6
7
8
# File 'lib/tasks/kibana.rb', line 5

def kibana_reports_source
  reports_source = "#{ibl_gem_path}/config/kibana_reports"
  Dir.entries(reports_source).keep_if {|e| e =~ /_report\.json$/i }.map {|e| "#{reports_source}/#{e}"}
end


18
19
20
# File 'lib/tasks/kibana.rb', line 18

def kibana_symlink_path
  "#{EasyAppHelper.config.root}/public/kibana"
end

#serve_ui(port = EasyAppHelper.config[:server_port]) ⇒ Object



34
35
36
37
38
# File 'lib/tasks/kibana.rb', line 34

def serve_ui(port=EasyAppHelper.config[:server_port])
  require 'webrick'
  port ||= EasyAppHelper.config[:server_port]
  WEBrick::HTTPServer.new(:Port => port, :DocumentRoot => kibana_path).start
end

#valid_kibana_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/tasks/kibana.rb', line 22

def valid_kibana_path? path
  File.exists? "#{path}/index.html"
end