Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
7dbc3d97
Commit
7dbc3d97
authored
Jun 30, 2016
by
Josh Frye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch permission denied errors and ignore the disk
parent
6e82c0e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
11 deletions
+38
-11
app/controllers/admin/system_info_controller.rb
app/controllers/admin/system_info_controller.rb
+38
-11
No files found.
app/controllers/admin/system_info_controller.rb
View file @
7dbc3d97
class
Admin::SystemInfoController
<
Admin
::
ApplicationController
def
show
excluded_mounts
=
[
"nobrowse"
,
"read-only"
,
"ro"
EXCLUDED_MOUNT_OPTIONS
=
[
'nobrowse'
,
'read-only'
,
'ro'
]
EXCLUDED_MOUNT_TYPES
=
[
'autofs'
,
'binfmt_misc'
,
'cgroup'
,
'debugfs'
,
'devfs'
,
'devpts'
,
'devtmpfs'
,
'efivarfs'
,
'fuse.gvfsd-fuse'
,
'fuseblk'
,
'fusectl'
,
'hugetlbfs'
,
'mqueue'
,
'proc'
,
'pstore'
,
'securityfs'
,
'sysfs'
,
'tmpfs'
,
'tracefs'
,
'vfat'
]
def
show
system_info
=
Vmstat
.
snapshot
mounts
=
Sys
::
Filesystem
.
mounts
@disks
=
[]
mounts
.
each
do
|
mount
|
options
=
mount
.
options
.
split
(
',
'
)
mount_options
=
mount
.
options
.
split
(
',
'
)
next
unless
excluded_mounts
.
each
{
|
em
|
break
if
options
.
include?
(
em
)
}
next
if
(
EXCLUDED_MOUNT_OPTIONS
&
mount_options
).
any?
next
if
(
EXCLUDED_MOUNT_TYPES
&
[
mount
.
mount_type
]).
any?
begin
disk
=
Sys
::
Filesystem
.
stat
(
mount
.
mount_point
)
@disks
.
push
({
bytes_total:
disk
.
bytes_total
,
...
...
@@ -22,6 +47,8 @@ class Admin::SystemInfoController < Admin::ApplicationController
disk_name:
mount
.
name
,
mount_path:
disk
.
path
})
rescue
Sys
::
Filesystem
::
Error
end
end
@cpus
=
system_info
.
cpus
.
length
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment