Add download system information button

This commit is contained in:
uu59 2014-07-10 16:24:41 +09:00
parent 1fe9ff49e6
commit e60ac201a5
5 changed files with 32 additions and 0 deletions

View File

@ -1,4 +1,5 @@
require "fluent/version"
require "zip"
class MiscController < ApplicationController
after_action :update!, only: [:update_fluentd_ui]
@ -31,6 +32,28 @@ class MiscController < ApplicationController
end
end
def download_info
fluentd = Fluentd.instance
path = Rails.root.join("tmp/system_info.zip")
File.unlink(path) if File.exists?(path)
Zip::File.open(path, Zip::File::CREATE) do |zip|
zip.get_output_stream('fluentd.log') {|f| f.puts fluentd.agent.log }
zip.add("fluentd-ui.log", Rails.root.join("log/#{Rails.env}.log"))
zip.get_output_stream('env.txt') do |f|
ENV.to_a.each do |(key, value)|
f.puts "#{key}=#{value}"
end
end
zip.get_output_stream('versions.txt') do |f|
f.puts "ruby: #{RUBY_DESCRIPTION}"
f.puts "fluentd: #{Fluent::VERSION}"
f.puts "fluentd-ui: #{FluentdUI::VERSION}"
end
end
send_file path
end
private
def update!

View File

@ -8,6 +8,12 @@
= t('.update_fluentd_ui', version: FluentdUI.latest_version)
= t('.update_fluentd_ui_caution')
.row
.col-lg-12
%p
=link_to misc_download_info_path, class: "btn btn-default" do
= t('.download_system_information')
.row
%div.col-lg-6
%div.panel.panel-default

View File

@ -189,6 +189,7 @@ en:
page_title: System Information
update_fluentd_ui: Update fluentd-ui
update_fluentd_ui_caution: "Note: fluentd will not restart"
download_system_information: Download system information
update_fluentd_ui:
<<: *misc_common
update_title: Updating fluentd-ui

View File

@ -185,6 +185,7 @@ ja:
page_title: システム情報
update_fluentd_ui: fluentd-uiを更新
update_fluentd_ui_caution: ※fluentdは再起動されません
download_system_information: システム情報をダウンロード
update_fluentd_ui:
<<: *misc_common
update_title: fluentd-ui 更新

View File

@ -39,6 +39,7 @@ Rails.application.routes.draw do
get "misc/information"
post "misc/update_fluentd_ui"
get "misc/upgrading_status"
get "misc/download_info"
namespace :polling do
get "alerts"