mool 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/lib/mool/base.rb +10 -0
- data/lib/mool/command.rb +4 -0
- data/lib/mool/cpu.rb +16 -16
- data/lib/mool/disk.rb +22 -13
- data/lib/mool/memory.rb +1 -1
- data/lib/mool/process.rb +3 -3
- data/lib/mool/system.rb +12 -12
- data/lib/mool/version.rb +1 -1
- data/lib/mool.rb +2 -1
- metadata +61 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c3812464b6a61004cb50688f19270a955bbe0f3
|
4
|
+
data.tar.gz: e7f68f5ee541f334c461b85b9bf229f5fb9d3d1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 465d925aa31816cc4996bfe07666a0791796c49ab211cc414aebbc89896d20f0cf1ff961d8c4535cd4bda1e83626dc21091d37d31e68d6b1932f8a15aeb3dd7a
|
7
|
+
data.tar.gz: '071799903439ad9539a1a8ed1644c15f98649bec02f3bac4d1228df9f2d994eed58cf01964b39fb4f12d04f5c4396a30f5a962c9787e3f334ab90f580b230717'
|
data/lib/mool/base.rb
ADDED
data/lib/mool/command.rb
CHANGED
data/lib/mool/cpu.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module Mool
|
2
|
-
class Cpu
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
2
|
+
class Cpu < Mool::Base
|
3
|
+
attr_accessor :cpu_name,
|
4
|
+
:id,
|
5
|
+
:model_name,
|
6
|
+
:cores,
|
7
|
+
:usr,
|
8
|
+
:nice,
|
9
|
+
:sys,
|
10
|
+
:iowait,
|
11
|
+
:irq,
|
12
|
+
:soft,
|
13
|
+
:steal,
|
14
|
+
:guest,
|
15
|
+
:gnice,
|
16
|
+
:idle,
|
17
|
+
:total
|
18
18
|
|
19
19
|
# ["all", "1", "2"]
|
20
20
|
def initialize(process_number, opt={})
|
data/lib/mool/disk.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Mool
|
2
|
-
class Disk
|
2
|
+
class Disk < Mool::Base
|
3
3
|
attr_accessor :path,
|
4
4
|
:major,
|
5
5
|
:minor,
|
@@ -17,13 +17,16 @@ module Mool
|
|
17
17
|
:unity
|
18
18
|
|
19
19
|
def initialize(dev_name)
|
20
|
-
|
21
|
-
Mool::Disk.dev_name_command(entry).include?(dev_name) ||
|
22
|
-
Mool::Disk.uevent_command(entry).include?(dev_name) ||
|
23
|
-
Mool::Disk.logical_name_command(entry)
|
24
|
-
end
|
20
|
+
@path = nil
|
25
21
|
|
26
|
-
|
22
|
+
Mool::Command.dev_block_command.each do |entry|
|
23
|
+
logical_name = Mool::Command.logical_name_command(entry)
|
24
|
+
next unless Mool::Command.dev_name_command(entry).include?(dev_name) ||
|
25
|
+
Mool::Command.uevent_command(entry).include?(dev_name) ||
|
26
|
+
(logical_name.present? && logical_name.include?(dev_name))
|
27
|
+
@path = entry
|
28
|
+
break
|
29
|
+
end
|
27
30
|
|
28
31
|
raise "Does't exist #{dev_name}!" if @path.nil?
|
29
32
|
read_uevent
|
@@ -60,9 +63,13 @@ module Mool
|
|
60
63
|
@major,
|
61
64
|
@minor,
|
62
65
|
@devname,
|
63
|
-
@devtype =
|
64
|
-
|
65
|
-
|
66
|
+
@devtype =
|
67
|
+
Mool::Command.uevent_command(@path).split("\n").map do |result|
|
68
|
+
result.split('=').last
|
69
|
+
end
|
70
|
+
# Mool::Command.uevent_command(@path).scan(
|
71
|
+
# /.*=(\d+)\n.*=(\d+)\n.*=(\S+)\n.*=(\w+)\n/
|
72
|
+
# ).flatten
|
66
73
|
end
|
67
74
|
|
68
75
|
def dev
|
@@ -95,11 +102,12 @@ module Mool
|
|
95
102
|
def partitions
|
96
103
|
return @partitions if defined? @partitions
|
97
104
|
return unless is_disk?
|
105
|
+
|
98
106
|
@partitions = Mool::Command.partitions_command(
|
99
107
|
@path,
|
100
108
|
@devname
|
101
109
|
).map do |part|
|
102
|
-
|
110
|
+
Mool::Disk.new(part.split('/').last)
|
103
111
|
end
|
104
112
|
end
|
105
113
|
|
@@ -110,7 +118,7 @@ module Mool
|
|
110
118
|
end
|
111
119
|
|
112
120
|
@slaves = blocks.map do |slave|
|
113
|
-
|
121
|
+
Mool::Disk.new(slave.split('/').last)
|
114
122
|
end
|
115
123
|
end
|
116
124
|
|
@@ -163,6 +171,7 @@ module Mool
|
|
163
171
|
!real_path.include?('/sr') &&
|
164
172
|
!Mool::Command.real_path_command_exist?(real_path) &&
|
165
173
|
Mool::Command.slaves_command(real_path).empty?
|
174
|
+
|
166
175
|
disks << Mool::Disk.new(entry.split('/').last)
|
167
176
|
end
|
168
177
|
|
@@ -177,7 +186,7 @@ module Mool
|
|
177
186
|
end
|
178
187
|
|
179
188
|
def self.all_usable
|
180
|
-
result =
|
189
|
+
result = Mool::Disk.all
|
181
190
|
result.each do |disk|
|
182
191
|
result += (disk.partitions +
|
183
192
|
disk.slaves +
|
data/lib/mool/memory.rb
CHANGED
data/lib/mool/process.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Mool
|
2
|
-
class Process
|
3
|
-
|
2
|
+
class Process < Mool::Base
|
3
|
+
attr_accessor :messures, :pattern
|
4
4
|
|
5
5
|
STATUS_PROCESS = {
|
6
6
|
'D' => :uninterruptible_sleep,
|
@@ -9,7 +9,7 @@ module Mool
|
|
9
9
|
'T' => :stopped_by_job_control_signal,
|
10
10
|
't' => :stopped_by_debugger_during_trace,
|
11
11
|
'Z' => :zombie
|
12
|
-
}
|
12
|
+
}.freeze
|
13
13
|
|
14
14
|
def initialize(name, pattern, opt = {})
|
15
15
|
if name.class != String || pattern.class != String
|
data/lib/mool/system.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Mool
|
2
|
-
class System
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
class System < Mool::Base
|
3
|
+
attr_accessor :kernel,
|
4
|
+
:current_loadavg,
|
5
|
+
:last_5min_loadavg,
|
6
|
+
:last_15min_loadavg,
|
7
|
+
:thread_entities_exec,
|
8
|
+
:total_thread_entities,
|
9
|
+
:last_pid_process_created,
|
10
|
+
:uptime_day,
|
11
|
+
:uptime_hour,
|
12
|
+
:uptime_minute,
|
13
|
+
:uptime_second
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
@kernel = Mool::Command.uname_command
|
data/lib/mool/version.rb
CHANGED
data/lib/mool.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mool
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- g.edera
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
version: "1.16"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
22
20
|
type: :development
|
23
|
-
version_requirements: *id001
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
name: rake
|
26
21
|
prerelease: false
|
27
|
-
|
28
|
-
requirements:
|
29
|
-
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
32
34
|
type: :development
|
33
|
-
version_requirements: *id002
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: minitest
|
36
35
|
prerelease: false
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
42
48
|
type: :development
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: 'Get operative system information: Disk, Memory, Cpu, Load-average, Processes.'
|
56
|
+
email:
|
46
57
|
- gab.edera@gmail.com
|
47
58
|
executables: []
|
48
|
-
|
49
59
|
extensions: []
|
50
|
-
|
51
60
|
extra_rdoc_files: []
|
52
|
-
|
53
|
-
|
54
|
-
- .gitignore
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
55
63
|
- Gemfile
|
56
64
|
- LICENSE.txt
|
57
65
|
- README.md
|
@@ -61,6 +69,7 @@ files:
|
|
61
69
|
- lib/locales/en.mool.yml
|
62
70
|
- lib/locales/es.mool.yml
|
63
71
|
- lib/mool.rb
|
72
|
+
- lib/mool/base.rb
|
64
73
|
- lib/mool/command.rb
|
65
74
|
- lib/mool/cpu.rb
|
66
75
|
- lib/mool/disk.rb
|
@@ -70,30 +79,28 @@ files:
|
|
70
79
|
- lib/mool/version.rb
|
71
80
|
- mool.gemspec
|
72
81
|
homepage: https://github.com/gedera/mool
|
73
|
-
licenses:
|
82
|
+
licenses:
|
74
83
|
- MIT
|
75
|
-
metadata:
|
84
|
+
metadata:
|
76
85
|
allowed_push_host: https://rubygems.org
|
77
86
|
post_install_message:
|
78
87
|
rdoc_options: []
|
79
|
-
|
80
|
-
require_paths:
|
88
|
+
require_paths:
|
81
89
|
- lib
|
82
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
-
requirements:
|
84
|
-
-
|
85
|
-
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
91
100
|
requirements: []
|
92
|
-
|
93
101
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.6.
|
102
|
+
rubygems_version: 2.6.14
|
95
103
|
signing_key:
|
96
104
|
specification_version: 4
|
97
105
|
summary: Get operative system information (Linux).
|
98
106
|
test_files: []
|
99
|
-
|