Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-25 20:44:08 +0300
committerRuben Davila <rdavila84@gmail.com>2016-08-26 19:32:07 +0300
commitef5758469698d82c181c6480d160aa5e2475728a (patch)
tree39f514f22b0777aab7152fb4873eb9e0bc46ab54 /app
parent52b07013e7aec539b864299744090e331408a550 (diff)
Merge branch '21378-error-500-after-8-11-update-on-system-infos-page' into 'master'
Handle unavailable system info ## What does this MR do? Handle the case where we can't get system info without blowing up. As this is the first tab in the monitoring section, it's difficult to get to the other tabs if this page throws a 500. Also be more specific about the info we want, so we don't fail on something we don't care about (like `/proc/net/dev`). ## Why was this MR needed? grsecurity can prevent users from reading `/proc`, which is what Vmstat uses to find CPU and memory info. ## What are the relevant issue numbers? Closes #21378. See merge request !5989
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..bfc6142067a 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
+ = icon('warning', class: '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
+ = icon('warning', class: 'text-warning')
+ Unable to collect memory info
.col-sm-4
.light-well
%h4 Disks