Commit 82edef94 authored by Josh Frye's avatar Josh Frye

Show basic system info on admin panel. Closes #18886

parent ebe21acc
......@@ -346,3 +346,7 @@ gem "paranoia", "~> 2.0"
# Health check
gem 'health_check', '~> 1.5.1'
# System information
gem 'vmstat', '~> 2.1.0'
gem 'filesize', '~> 0.1.1'
......@@ -207,6 +207,7 @@ GEM
multi_json
ffaker (2.0.0)
ffi (1.9.10)
filesize (0.1.1)
flay (2.6.1)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
......@@ -780,6 +781,7 @@ GEM
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
vmstat (2.1.0)
warden (1.2.6)
rack (>= 1.0)
web-console (2.3.0)
......@@ -849,6 +851,7 @@ DEPENDENCIES
email_spec (~> 1.6.0)
factory_girl_rails (~> 4.6.0)
ffaker (~> 2.0.0)
filesize (~> 0.1.1)
flay
flog
fog-aws (~> 0.9)
......@@ -984,6 +987,7 @@ DEPENDENCIES
unicorn-worker-killer (~> 0.4.2)
version_sorter (~> 2.0.0)
virtus (~> 1.0.1)
vmstat (~> 2.1.0)
web-console (~> 2.0)
webmock (~> 1.21.0)
wikicloth (= 0.8.1)
......
class Admin::SystemInfoController < Admin::ApplicationController
def show
system_info = Vmstat.snapshot
@load = system_info.load_average.collect { |v| v.round(2) }.join(', ')
@mem_used = Filesize.from("#{system_info.memory.active_bytes} B").to_s('GB')
@mem_total = Filesize.from("#{system_info.memory.total_bytes} B").to_s('GB')
@disk_used = Filesize.from("#{system_info.disks[0].used_bytes} B").to_s('GB')
@disk_total = Filesize.from("#{system_info.disks[0].total_bytes} B").to_s('GB')
end
end
.nav-links.sub-nav
%ul{ class: (container_class) }
= nav_link(controller: :system_info) do
= link_to admin_system_info_path, title: 'System Info' do
%span
System Info
= nav_link(controller: :background_jobs) do
= link_to admin_background_jobs_path, title: 'Background Jobs' do
%span
......
- @no_container = true
- page_title "System Info"
= render 'admin/background_jobs/head'
%div{ class: (container_class) }
%p
.row
.col-sm-4
.light-well
%h4 CPU Load
.data
%h1= @load
.col-sm-4
.light-well
%h4 Memory
.data
%h1= "#{@mem_used} / #{@mem_total}"
.col-sm-4
.light-well
%h4 Disk
.data
%h1= "#{@disk_used} / #{@disk_total}"
......@@ -280,6 +280,7 @@ Rails.application.routes.draw do
resource :logs, only: [:show]
resource :health_check, controller: 'health_check', only: [:show]
resource :background_jobs, controller: 'background_jobs', only: [:show]
resource :system_info, controller: 'system_info', only: [:show]
resources :namespaces, path: '/projects', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
root to: 'projects#index', as: :projects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment