summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-08-24 18:06:19 +0100
committerSean McGivern <sean@gitlab.com>2016-08-25 08:28:35 +0100
commit085e1f89f327ad4d679696fe4673d09e1840b236 (patch)
tree585a47ab6e78653692d249158cb0f689bdd573d3 /app
parentb2bf01f4c271be66e93ed6f4b48a1da4d50e558d (diff)
downloadgitlab-ce-085e1f89f327ad4d679696fe4673d09e1840b236.tar.gz
Handle unavailable system info
For Linux with the grsecurity patches applied, paths in `/proc` may not be readable, so handle those cases and show a message rather than blowing up.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/system_info_controller.rb8
-rw-r--r--app/views/admin/system_info/show.html.haml12
2 files changed, 12 insertions, 8 deletions
diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb
index e4c73008826..ca04a17caa1 100644
--- a/app/controllers/admin/system_info_controller.rb
+++ b/app/controllers/admin/system_info_controller.rb
@@ -29,7 +29,8 @@ class Admin::SystemInfoController < Admin::ApplicationController
]
def show
- system_info = Vmstat.snapshot
+ @cpus = Vmstat.cpu rescue nil
+ @memory = Vmstat.memory rescue nil
mounts = Sys::Filesystem.mounts
@disks = []
@@ -50,10 +51,5 @@ class Admin::SystemInfoController < Admin::ApplicationController
rescue Sys::Filesystem::Error
end
end
-
- @cpus = system_info.cpus.length
-
- @mem_used = system_info.memory.active_bytes
- @mem_total = system_info.memory.total_bytes
end
end
diff --git a/app/views/admin/system_info/show.html.haml b/app/views/admin/system_info/show.html.haml
index 6956e5ab795..7f3b95699db 100644
--- a/app/views/admin/system_info/show.html.haml
+++ b/app/views/admin/system_info/show.html.haml
@@ -9,12 +9,20 @@
.light-well
%h4 CPU
.data
- %h1= "#{@cpus} cores"
+ - if @cpus
+ %h1= "#{@cpus.length} cores"
+ - else
+ %i.fa.fa-warning.text-warning
+ Unable to collect CPU info
.col-sm-4
.light-well
%h4 Memory
.data
- %h1= "#{number_to_human_size(@mem_used)} / #{number_to_human_size(@mem_total)}"
+ - if @memory
+ %h1= "#{number_to_human_size(@memory.active_bytes)} / #{number_to_human_size(@memory.total_bytes)}"
+ - else
+ %i.fa.fa-warning.text-warning
+ Unable to collect memory info
.col-sm-4
.light-well
%h4 Disks