mool 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8477ba46078b98c0d9f884f5cacc89808fff854
4
+ data.tar.gz: '0839c25dbe6c556890fe346672fce5a5dd14c538'
5
+ SHA512:
6
+ metadata.gz: 6591a0c654a4fa054a1d291cd7120216015589c63996ae4948d2f211be9707ff00579ef99cc109a91721cc42b0b322edc65067435b9ea0a60c00f9147ce3b842
7
+ data.tar.gz: 856d6dae91e23b6d0b00fcb4191f79be0fe166f90057f6dcbd7a30a87dd1430cccac70f69cb105e8fc84a8ac3638fc6d51aa3549376a14a90ff19c37bef05605
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
2
4
 
3
5
  # Specify your gem's dependencies in mool.gemspec
4
6
  gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2015 g.edera
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2018 g.edera
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  The best thing to have this gem is how get the information. The information is obtained from different source but mainly from files and basic commands such as **"top"**, **"mpstat"** and **"df"**.
5
5
 
6
+ Tested on **Alpine**, **Debian** and **Ubuntu**,
7
+
6
8
  ## Installation
7
9
  Add this line to your application's Gemfile:
8
10
  ```ruby
@@ -17,197 +19,450 @@ Or install it yourself as:
17
19
  $ gem install mool
18
20
  ```
19
21
 
22
+ ## Package required
23
+
24
+ - sysstat: `sudo aptitude install sysstat`
25
+
20
26
  ## Usage
21
27
  ### CPU
22
28
  You can check the posible values to use with:
23
29
  ```ruby
24
- > MoolCpu::PROCESSORS
30
+ > MoolCpu.processors
25
31
  ["0", "1", "2", "4", "all"]
26
32
  ```
27
33
  It's posible get all cpu information:
28
34
  ```ruby
29
- > MoolCpu.all
35
+ > Mool::Cpu.all
30
36
  [
31
- [0] #<MoolCpu:0x7f82959381a8 @nice=0.0, @gnice=0.0, @total=2.0, @irq=0.0, @usr=2.0, @guest=0.0, @iowait=0.0, @cores=2, @steal=0.0, @sys=0.0, @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz", @idle=97.0, @cpu_name="cpu_3", @soft=0.0>,
32
- [1] #<MoolCpu:0x7f8295937ca8 @nice=0.0, @gnice=0.0, @total=1.0, @irq=0.0, @usr=1.0, @guest=0.0, @iowait=0.0, @cores=2, @steal=0.0, @sys=0.0, @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz", @idle=97.0, @cpu_name="cpu_2", @soft=0.0>,
33
- [2] #<MoolCpu:0x7f82959377a8 @nice=0.0, @gnice=0.0, @total=3.0, @irq=0.0, @usr=1.0, @guest=0.0, @iowait=2.0, @cores=2, @steal=0.0, @sys=0.0, @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz", @idle=96.0, @cpu_name="cpu_1", @soft=0.0>,
34
- [3] #<MoolCpu:0x7f82959372a8 @nice=0.0, @gnice=0.0, @total=4.0, @irq=0.0, @usr=3.0, @guest=0.0, @iowait=0.0, @cores=2, @steal=0.0, @sys=1.0, @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz", @idle=95.0, @cpu_name="cpu_0", @soft=0.0>,
35
- [4] #<MoolCpu:0x7f8295936da8 @nice=0.0, @gnice=0.0, @total=2.0, @irq=0.0, @usr=2.0, @guest=0.0, @iowait=0.0, @cores=0, @steal=0.0, @sys=0.0, @model_name=nil, @idle=96.0, @cpu_name="cpu_all", @soft=0.0>
37
+ [0] #<Mool::Cpu:0x7f82959381a8
38
+ @nice=0.0,
39
+ @gnice=0.0,
40
+ @total=2.0,
41
+ @irq=0.0,
42
+ @usr=2.0,
43
+ @guest=0.0,
44
+ @iowait=0.0,
45
+ @cores=2,
46
+ @steal=0.0,
47
+ @sys=0.0,
48
+ @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz",
49
+ @idle=97.0,
50
+ @cpu_name="cpu_3",
51
+ @soft=0.0>,
52
+ [1] #<Mool::Cpu:0x7f8295937ca8
53
+ @nice=0.0,
54
+ @gnice=0.0,
55
+ @total=1.0,
56
+ @irq=0.0,
57
+ @usr=1.0,
58
+ @guest=0.0,
59
+ @iowait=0.0,
60
+ @cores=2,
61
+ @steal=0.0,
62
+ @sys=0.0,
63
+ @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz",
64
+ @idle=97.0,
65
+ @cpu_name="cpu_2",
66
+ @soft=0.0>,
67
+ [2] #<Mool::Cpu:0x7f82959377a8
68
+ @nice=0.0,
69
+ @gnice=0.0,
70
+ @total=3.0,
71
+ @irq=0.0,
72
+ @usr=1.0,
73
+ @guest=0.0,
74
+ @iowait=2.0,
75
+ @cores=2,
76
+ @steal=0.0,
77
+ @sys=0.0,
78
+ @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz",
79
+ @idle=96.0,
80
+ @cpu_name="cpu_1",
81
+ @soft=0.0>,
82
+ [3] #<Mool::Cpu:0x7f82959372a8
83
+ @nice=0.0,
84
+ @gnice=0.0,
85
+ @total=4.0,
86
+ @irq=0.0,
87
+ @usr=3.0,
88
+ @guest=0.0,
89
+ @iowait=0.0,
90
+ @cores=2,
91
+ @steal=0.0,
92
+ @sys=1.0,
93
+ @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz",
94
+ @idle=95.0,
95
+ @cpu_name="cpu_0",
96
+ @soft=0.0>,
97
+ [4] #<Mool::Cpu:0x7f8295936da8
98
+ @nice=0.0,
99
+ @gnice=0.0,
100
+ @total=2.0,
101
+ @irq=0.0,
102
+ @usr=2.0,
103
+ @guest=0.0,
104
+ @iowait=0.0,
105
+ @cores=0,
106
+ @steal=0.0,
107
+ @sys=0.0,
108
+ @model_name=nil,
109
+ @idle=96.0,
110
+ @cpu_name="cpu_all",
111
+ @soft=0.0>
36
112
  ]
37
113
  ```
38
114
  Or can get a specific cpu information:
39
- ```ruby
40
- >> MoolCpu.new(0) or MoolCpu.new("0")
41
- #<MoolCpu:0x7f82959381a8 @nice=0.0, @gnice=0.0, @total=2.0, @irq=0.0, @usr=2.0, @guest=0.0, @iowait=0.0, @cores=2, @steal=0.0, @sys=0.0, @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz", @idle=97.0, @cpu_name="cpu_3", @soft=0.0>
42
- ```
43
- ### Load-Average (V. 1.0.1)
44
115
  ```ruby
45
- >> MoolLoadAverage.new
46
- #<MoolLoadAverage:0x7f8295931c90 @total_thread_entities=638, @current_loadavg=0.08, @thread_entities_exec=2, @last_15min_loadavg=0.13, @last_pid_process_created=6264, @last_5min_loadavg=0.07>
116
+ >> Mool::Cpu.new(0) # Or you can Mool::Cpu.new("0")
117
+ #<Mool::Cpu:0x7f82959381a8
118
+ @nice=0.0,
119
+ @gnice=0.0,
120
+ @total=2.0,
121
+ @irq=0.0,
122
+ @usr=2.0,
123
+ @guest=0.0,
124
+ @iowait=0.0,
125
+ @cores=2,
126
+ @steal=0.0,
127
+ @sys=0.0,
128
+ @model_name="Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz",
129
+ @idle=97.0,
130
+ @cpu_name="cpu_3",
131
+ @soft=0.0>
47
132
  ```
48
-
49
133
  ### System information (V. 2.0.0)
50
134
  Load average:
51
135
 
52
136
  ```ruby
53
- >> MoolSystem.new.load_average
54
- { :total_thread_entities => 638, :current_loadavg => 0.08, :thread_entities_exec => 2, :last_15min_loadavg => 0.13, :last_pid_process_created => 6264, :last_5min_loadavg => 0.07 }
137
+ >> Mool::System.new.load_average
138
+ { :total_thread_entities => 638,
139
+ :current_loadavg => 0.08,
140
+ :thread_entities_exec => 2,
141
+ :last_15min_loadavg => 0.13,
142
+ :last_pid_process_created => 6264,
143
+ :last_5min_loadavg => 0.07 }
55
144
  ```
56
145
 
57
146
  uptime:
58
147
 
59
148
  ```ruby
60
- >> MoolSystem.new.uptime
61
- { :uptime_day => 4, :uptime_hour => 3, :uptime_minute => 20, :uptime_second => 10 }
149
+ >> Mool::System.new.uptime
150
+ { :uptime_day => 4,
151
+ :uptime_hour => 3,
152
+ :uptime_minute => 20,
153
+ :uptime_second => 10 }
62
154
  ```
63
155
 
64
156
  Kernel version:
65
157
 
66
158
  ```ruby
67
- >> MoolSystem.new.kernel_version
159
+ >> Mool::System.new.kernel_version
68
160
  "4.6.0-1-amd64"
69
161
  ```
70
162
 
71
163
 
72
164
  ### Memory
73
165
  ```ruby
74
- >> MoolMemory.new
75
- --- !ruby/object:MoolMemory
76
- active: 2906775552.0
77
- active_anon: 2175971328.0
78
- active_file: 730804224.0
79
- anon_huge_pages: 0.0
80
- anon_pages: 2174132224.0
81
- bounce: 0.0
82
- buffers: 73887744.0
83
- cached: 1795256320.0
84
- commit_limit: 7322968064.0
85
- committed_as: 8012181504.0
86
- direct_map2_m: 12499025920.0
87
- direct_map4k: 280199168.0
88
- dirty: 217088.0
89
- hardware_corrupted: 0.0
90
- huge_pages_free: 0.0
91
- huge_pages_rsvd: 0.0
92
- huge_pages_surp: 0.0
93
- huge_pages_total: 0.0
94
- hugepagesize: 2097152.0
95
- inactive: 1136472064.0
96
- inactive_anon: 573755392.0
97
- inactive_file: 562716672.0
98
- kernel_stack: 10485760.0
99
- mapped: 692449280.0
100
- mem_available: 9536376832.0
101
- mem_free: 8219561984.0
102
- mem_total: 12498477056.0
103
- mem_used: 2409771008.0
104
- mlocked: 4096.0
105
- nfs_unstable: 0.0
106
- page_tables: 47812608.0
107
- s_reclaimable: 76697600.0
108
- s_unreclaim: 34598912.0
109
- shmem: 575635456.0
110
- slab: 111296512.0
111
- swap_cached: 0.0
112
- swap_free: 1073729536.0
113
- swap_total: 1073729536.0
114
- unevictable: 4096.0
115
- unity: Bytes
116
- vmalloc_chunk: 35183562584064.0
117
- vmalloc_total: 35184372087808.0
118
- vmalloc_used: 381046784.0
119
- writeback: 0.0
120
- writeback_tmp: 0.0
166
+ >> Mool::Memory.new
167
+ @active=5904642048.0,
168
+ @active_anon=3347439616.0,
169
+ @active_file=2557202432.0,
170
+ @anon_huge_pages=2260729856.0,
171
+ @anon_pages=4628471808.0,
172
+ @bounce=0.0,
173
+ @buffers=314597376.0,
174
+ @cached=3452170240.0,
175
+ @commit_limit=7319011328.0,
176
+ @committed_as=13602762752.0,
177
+ @direct_map2_m=8726249472.0,
178
+ @direct_map4k=4052975616.0,
179
+ @dirty=2002944.0,
180
+ @hardware_corrupted=0.0,
181
+ @huge_pages_free=0.0,
182
+ @huge_pages_rsvd=0.0,
183
+ @huge_pages_surp=0.0,
184
+ @huge_pages_total=0.0,
185
+ @hugepagesize=2097152.0,
186
+ @inactive=2607034368.0,
187
+ @inactive_anon=1485414400.0,
188
+ @inactive_file=1121619968.0,
189
+ @kernel_stack=18612224.0,
190
+ @mapped=1865633792.0,
191
+ @mem_available=5570912256.0,
192
+ @mem_free=1771671552.0,
193
+ @mem_total=12490563584.0,
194
+ @mem_used=6926209024.0,
195
+ @mlocked=143360.0,
196
+ @nfs_unstable=0.0,
197
+ @page_tables=70656000.0,
198
+ @s_reclaimable=448073728.0,
199
+ @s_unreclaim=171155456.0,
200
+ @shmem=444522496.0,
201
+ @shmem_huge_pages=0.0,
202
+ @shmem_pmd_mapped=0.0,
203
+ @slab=619229184.0,
204
+ @swap_cached=25915392.0,
205
+ @swap_free=308559872.0,
206
+ @swap_total=1073729536.0,
207
+ @unevictable=143360.0,
208
+ @unity="Bytes",
209
+ @vmalloc_chunk=0.0,
210
+ @vmalloc_total=35184372087808.0,
211
+ @vmalloc_used=0.0,
212
+ @writeback=0.0,
213
+ @writeback_tmp=0.0>
121
214
  ```
122
215
  By default the values are in Bytes. So it's posible to changed to different units (Bytes Kbytes, Mbytes, Gbytes).
123
216
  ```ruby
124
- >> MoolMemory.new.to_b
125
- >> MoolMemory.new.to_kb
126
- >> MoolMemory.new.to_mb
127
- >> MoolMemory.new.to_gb
217
+ >> Mool::Memory.new.to_b
218
+ >> Mool::Memory.new.to_kb
219
+ >> Mool::Memory.new.to_mb
220
+ >> Mool::Memory.new.to_gb
128
221
  ```
129
- ## Service or Process
222
+ ## Process
130
223
  To get process information you can provide two params:
131
224
  1) **name**: This name it's used as key.
132
225
  2) **pattern**: Used to match with the command top.
133
226
  ```ruby
134
- >> MoolService.new("profanity Process", "profanity")
135
- #<MoolService:0x7f4c23f929e8 @messure=[{ :status=>"Sleeping",
136
- :command=>"profanity",
137
- :time=>"0:08.22",
138
- :pattern=>"profanity",
139
- :nice=>"0",
140
- :pid=>"1764",
141
- :memory_in_kb=>"34376",
142
- :user=>"mool",
143
- :cpu_percentage=>"0,0",
144
- :name=>"profanity Process",
145
- :mem_percentage=>"0,3",
146
- :priority=>"20" }]>
227
+ >> Mool::Process.new("Slim Process", "slim")
228
+ => #<Mool::Process:0x000055618b982fc8
229
+ @messures=
230
+ [{:name=>"Slim Process",
231
+ :pattern=>"slim",
232
+ :ruser=>"root",
233
+ :user=>"root",
234
+ :rgroup=>"root",
235
+ :group=>"root",
236
+ :pid=>"792",
237
+ :ppid=>"1",
238
+ :pgid=>"792",
239
+ :pcpu=>"0.0",
240
+ :vsz=>"167452",
241
+ :nice=>"0",
242
+ :etime=>"23-06:15:22",
243
+ :time=>"00:00:00",
244
+ :tty=>"?",
245
+ :comm=>"slim",
246
+ :args=>"/usr/bin/slim -nodaemon",
247
+ :priority=>"20",
248
+ :virt=>"167452",
249
+ :res=>"38620",
250
+ :shr=>"7072",
251
+ :status=>:sleeping,
252
+ :cpu_percentage=>"0,0",
253
+ :mem_percentage=>"0,3",
254
+ :time_plus=>"0,3"}],
255
+ @pattern="slim">
147
256
  ```
148
257
 
149
258
  In this case we have only one messure, but exists especial cases, where the pattern match with more than one process. This cases will have more than one messure, such as:
150
259
  ```ruby
151
- >> MoolService.new("Terminal", "urxvt")
152
- #<MoolService:0x7f4c23f88f88 @messure=[ { :status=>"Sleeping",
153
- :command=>"urxvt",
154
- :time=>"0:02.80",
155
- :pattern=>"urxvt",
156
- :nice=>"0",
157
- :pid=>"1672",
158
- :memory_in_kb=>"16152",
159
- :user=>"mool",
160
- :cpu_percentage=>"0,0",
161
- :name=>"Terminal",
162
- :mem_percentage=>"0,1",
163
- :priority=>"20" },
164
- { :status=>"Sleeping",
165
- :command=>"urxvt",
166
- :time=>"0:00.00",
167
- :pattern=>"urxvt",
168
- :nice=>"0",
169
- :pid=>"1673",
170
- :memory_in_kb=>"4020",
171
- :user=>"mool",
172
- :cpu_percentage=>"0,0",
173
- :name=>"Terminal",
174
- :mem_percentage=>"0,0",
175
- :priority=>"20" } ]>
260
+ >> Mool::Process.new("Terminal", "urxvt")
261
+ => #<Mool::Process:0x000055618be9a268
262
+ @messures=
263
+ [{:name=>"URXVT Process",
264
+ :pattern=>"urxvt",
265
+ :ruser=>"gabriel",
266
+ :user=>"gabriel",
267
+ :rgroup=>"gabriel",
268
+ :group=>"gabriel",
269
+ :pid=>"2040",
270
+ :ppid=>"1",
271
+ :pgid=>"2040",
272
+ :pcpu=>"0.0",
273
+ :vsz=>"118676",
274
+ :nice=>"0",
275
+ :etime=>"9-03:04:45",
276
+ :time=>"00:00:55",
277
+ :tty=>"?",
278
+ :comm=>"urxvt",
279
+ :args=>"urxvt",
280
+ :priority=>"20",
281
+ :virt=>"118676",
282
+ :res=>"24280",
283
+ :shr=>"11192",
284
+ :status=>:sleeping,
285
+ :cpu_percentage=>"0,0",
286
+ :mem_percentage=>"0,2",
287
+ :time_plus=>"0,2"},
288
+ {:name=>"URXVT Process",
289
+ :pattern=>"urxvt",
290
+ :ruser=>"gabriel",
291
+ :user=>"gabriel",
292
+ :rgroup=>"gabriel",
293
+ :group=>"utmp",
294
+ :pid=>"2041",
295
+ :ppid=>"2040",
296
+ :pgid=>"2040",
297
+ :pcpu=>"0.0",
298
+ :vsz=>"95560",
299
+ :nice=>"0",
300
+ :etime=>"9-03:04:45",
301
+ :time=>"00:00:00",
302
+ :tty=>"?",
303
+ :comm=>"urxvt",
304
+ :args=>"urxvt",
305
+ :priority=>"20",
306
+ :virt=>"95560",
307
+ :res=>"4160",
308
+ :shr=>"3480",
309
+ :status=>:sleeping,
310
+ :cpu_percentage=>"0,0",
311
+ :mem_percentage=>"0,0",
312
+ :time_plus=>"0,0"}],
313
+ @pattern="urxvt">
176
314
  ```
177
315
  ### Disk
178
316
  It's possible to get disk, partition or virtual device information using dev name **MAJOR:MINOR** ("**8:2**"), device name **sda**, **sda1** or virtual device such as "**lvm-sda2**" or "**md0**".
179
317
  ```ruby
180
- >> MoolDisk.new("8:0")
181
- #<MoolDisk:0x7fdc6e283f00 @logical_name="sda", @total_block=500107862016.0, @devtype="disk", @mount_point="/boot", @swap=false, @minor="0", @devname="sda", @block_free=0.0, @path="/sys/dev/block/8:0", @major="8", @file_system="ext4", @unity="Bytes", @block_used=0.0>
182
- >> MoolDisk.new("sda1")
183
- #<MoolDisk:0x7fdc6e266a40 @logical_name="sda1", @total_block=262144000.0, @devtype="partition", @mount_point="/boot", @swap=false, @minor="1", @devname="sda1", @block_free=59062784.0, @path="/sys/dev/block/8:1", @major="8", @file_system="ext4", @unity="Bytes", @block_used=57123840.0>
184
- >> MoolDisk.new("sdblvm-homelvm")
185
- #<MoolDisk:0x7fdc6e248658 @logical_name="sdblvm-homelvm", @total_block=445602856960.0, @devtype="disk", @mount_point="/boot", @swap=false, @minor="3", @devname="dm-3", @block_free=187429210112.0, @path="/sys/dev/block/252:3", @major="252", @file_system="btrfs", @unity="Bytes", @block_used=34269296640.0>
318
+ >> Mool::Disk.new("8:0")
319
+ #<Mool::Disk:0x7fdc6e283f00 @logical_name="sda",
320
+ @total_block=500107862016.0,
321
+ @devtype="disk",
322
+ @mount_point="/boot",
323
+ @swap=false,
324
+ @minor="0",
325
+ @devname="sda",
326
+ @block_free=0.0,
327
+ @path="/sys/dev/block/8:0",
328
+ @major="8",
329
+ @file_system="ext4",
330
+ @unity="Bytes",
331
+ @block_used=0.0>
332
+ >> Mool::Disk.new("sda1")
333
+ #<Mool::Disk:0x7fdc6e266a40 @logical_name="sda1",
334
+ @total_block=262144000.0,
335
+ @devtype="partition",
336
+ @mount_point="/boot",
337
+ @swap=false,
338
+ @minor="1",
339
+ @devname="sda1",
340
+ @block_free=59062784.0,
341
+ @path="/sys/dev/block/8:1",
342
+ @major="8",
343
+ @file_system="ext4",
344
+ @unity="Bytes",
345
+ @block_used=57123840.0>
346
+ >> Mool::Disk.new("sdblvm-homelvm")
347
+ #<Mool::Disk:0x7fdc6e248658 @logical_name="sdblvm-homelvm",
348
+ @total_block=445602856960.0,
349
+ @devtype="disk",
350
+ @mount_point="/boot",
351
+ @swap=false,
352
+ @minor="3",
353
+ @devname="dm-3",
354
+ @block_free=187429210112.0,
355
+ @path="/sys/dev/block/252:3",
356
+ @major="252",
357
+ @file_system="btrfs",
358
+ @unity="Bytes",
359
+ @block_used=34269296640.0>
186
360
  ```
187
361
  It's possible get all partition if the object is `@devtype="disk"`, such as:
188
362
  ```ruby
189
- >> MoolDisk.new("sda").partitions
363
+ >> Mool::Disk.new("sda").partitions
190
364
  [
191
- [0] #<MoolDisk:0x7fdc6eb3cd18 @logical_name="sda1", @total_block=262144000.0, @devtype="partition", @mount_point="/boot", @swap=false, @minor="1", @devname="sda1", @block_free=59062784.0, @path="/sys/dev/block/8:1", @major="8", @file_system="ext4", @unity="Bytes", @block_used=57123840.0>,
192
- [1] #<MoolDisk:0x7fdc6e9e7788 @logical_name="sda2", @total_block=1073741824.0, @devtype="partition", @swap=true, @minor="2", @devname="sda2", @block_free=0.0, @path="/sys/dev/block/8:2", @major="8", @file_system="cgroup", @unity="Bytes", @block_used=0.0>,
193
- [2] #<MoolDisk:0x7fdc6e8d7f78 @logical_name="sda3", @total_block=498770927616.0, @devtype="partition", @swap=false, @minor="3", @devname="sda3", @block_free=0.0, @path="/sys/dev/block/8:3", @major="8", @file_system=nil, @unity="Bytes", @block_used=0.0>
365
+ [0] #<Mool::Disk:0x7fdc6eb3cd18 @logical_name="sda1",
366
+ @total_block=262144000.0,
367
+ @devtype="partition",
368
+ @mount_point="/boot",
369
+ @swap=false,
370
+ @minor="1",
371
+ @devname="sda1",
372
+ @block_free=59062784.0,
373
+ @path="/sys/dev/block/8:1",
374
+ @major="8",
375
+ @file_system="ext4",
376
+ @unity="Bytes",
377
+ @block_used=57123840.0>,
378
+ [1] #<Mool::Disk:0x7fdc6e9e7788 @logical_name="sda2",
379
+ @total_block=1073741824.0,
380
+ @devtype="partition",
381
+ @swap=true,
382
+ @minor="2",
383
+ @devname="sda2",
384
+ @block_free=0.0,
385
+ @path="/sys/dev/block/8:2",
386
+ @major="8",
387
+ @file_system="cgroup",
388
+ @unity="Bytes",
389
+ @block_used=0.0>,
390
+ [2] #<Mool::Disk:0x7fdc6e8d7f78 @logical_name="sda3",
391
+ @total_block=498770927616.0,
392
+ @devtype="partition",
393
+ @swap=false,
394
+ @minor="3",
395
+ @devname="sda3",
396
+ @block_free=0.0,
397
+ @path="/sys/dev/block/8:3",
398
+ @major="8",
399
+ @file_system=nil,
400
+ @unity="Bytes",
401
+ @block_used=0.0>
194
402
  ]
195
403
  ```
196
404
  Otherwise it's possible too get the slaves. The slaves are virtual devices for examples `lvm` or `raid`.
197
405
 
198
406
  ```ruby
199
- >> MoolDisk.new("sda3").slaves
407
+ >> Mool::Disk.new("sda3").slaves
200
408
  [
201
- [0] #<MoolDisk:0x7fdc6e6bec00 @logical_name="sdblvm-rootlvm", @total_block=32212254720.0, @devtype="disk", @swap=false, @minor="0", @devname="dm-0", @block_free=9739984896.0, @path="/sys/dev/block/252:0", @major="252", @file_system="ext4", @unity="Bytes", @block_used=5232629760.0>,
202
- [1] #<MoolDisk:0x7fdc6e672350 @logical_name="sdblvm-tmplvm", @total_block=4294967296.0, @devtype="disk", @mount_point="/boot", @swap=false, @minor="1", @devname="dm-1", @block_free=1926668288.0, @path="/sys/dev/block/252:1", @major="252", @file_system="ext4", @unity="Bytes", @block_used=4227072.0>,
203
- [2] #<MoolDisk:0x7fdc6e627ff8 @logical_name="sdblvm-varlvm", @total_block=16106127360.0, @devtype="disk", @mount_point="/boot", @swap=false, @minor="2", @devname="dm-2", @block_free=5497151488.0, @path="/sys/dev/block/252:2", @major="252", @file_system="ext4", @unity="Bytes", @block_used=1951399936.0>,
204
- [3] #<MoolDisk:0x7fdc6e5cec78 @logical_name="sdblvm-homelvm", @total_block=445602856960.0, @devtype="disk", @mount_point="/boot", @swap=false, @minor="3", @devname="dm-3", @block_free=187430152192.0, @path="/sys/dev/block/252:3", @major="252", @file_system="btrfs", @unity="Bytes", @block_used=34268366848.0>
409
+ [0] #<Mool::Disk:0x7fdc6e6bec00 @logical_name="sdblvm-rootlvm",
410
+ @total_block=32212254720.0,
411
+ @devtype="disk",
412
+ @swap=false,
413
+ @minor="0",
414
+ @devname="dm-0",
415
+ @block_free=9739984896.0,
416
+ @path="/sys/dev/block/252:0",
417
+ @major="252",
418
+ @file_system="ext4",
419
+ @unity="Bytes",
420
+ @block_used=5232629760.0>,
421
+ [1] #<Mool::Disk:0x7fdc6e672350 @logical_name="sdblvm-tmplvm",
422
+ @total_block=4294967296.0,
423
+ @devtype="disk",
424
+ @mount_point="/boot",
425
+ @swap=false,
426
+ @minor="1",
427
+ @devname="dm-1",
428
+ @block_free=1926668288.0,
429
+ @path="/sys/dev/block/252:1",
430
+ @major="252",
431
+ @file_system="ext4",
432
+ @unity="Bytes",
433
+ @block_used=4227072.0>,
434
+ [2] #<Mool::Disk:0x7fdc6e627ff8 @logical_name="sdblvm-varlvm",
435
+ @total_block=16106127360.0,
436
+ @devtype="disk",
437
+ @mount_point="/boot",
438
+ @swap=false,
439
+ @minor="2",
440
+ @devname="dm-2",
441
+ @block_free=5497151488.0,
442
+ @path="/sys/dev/block/252:2",
443
+ @major="252",
444
+ @file_system="ext4",
445
+ @unity="Bytes",
446
+ @block_used=1951399936.0>,
447
+ [3] #<Mool::Disk:0x7fdc6e5cec78 @logical_name="sdblvm-homelvm",
448
+ @total_block=445602856960.0,
449
+ @devtype="disk",
450
+ @mount_point="/boot",
451
+ @swap=false,
452
+ @minor="3",
453
+ @devname="dm-3",
454
+ @block_free=187430152192.0,
455
+ @path="/sys/dev/block/252:3",
456
+ @major="252",
457
+ @file_system="btrfs",
458
+ @unity="Bytes",
459
+ @block_used=34268366848.0>
205
460
  ]
206
461
  ```
207
462
 
208
463
  Other way is get all disk with yours parititons and slaves.
209
464
  ```ruby
210
- >> MoolDisk.all
465
+ >> Mool::Disk.all
211
466
  - !ruby/object:MoolDisk
212
467
  block_free: 0.0
213
468
  block_used: 0.0
@@ -331,11 +586,22 @@ Swap partition:
331
586
 
332
587
  ```ruby
333
588
  >> MoolDisk.swap
334
- #<MoolDisk:0x7f711644d890 @file_system="cgroup", @unity="Bytes", @block_used=0.0, @logical_name="sda2", @total_block=1073741824.0, @minor="2", @devtype="partition", @path="/sys/dev/block/8:2", @swap=true, @major="8", @devname="sda2", @block_free=1073741824.0>
589
+ #<Mool::Disk:0x7f711644d890 @file_system="cgroup",
590
+ @unity="Bytes",
591
+ @block_used=0.0,
592
+ @logical_name="sda2",
593
+ @total_block=1073741824.0,
594
+ @minor="2",
595
+ @devtype="partition",
596
+ @path="/sys/dev/block/8:2",
597
+ @swap=true,
598
+ @major="8",
599
+ @ devname="sda2",
600
+ @block_free=1073741824.0>
335
601
  ```
336
602
 
337
603
  ### Version
338
- 1.0.1
604
+ 3.0.0
339
605
 
340
606
  License
341
607
  ----