mool 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +3 -1
- data/LICENSE.txt +17 -18
- data/README.md +394 -128
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mool.rb +24 -18
- data/lib/mool/command.rb +86 -0
- data/lib/mool/cpu.rb +74 -47
- data/lib/mool/disk.rb +159 -87
- data/lib/mool/memory.rb +48 -15
- data/lib/mool/process.rb +129 -0
- data/lib/mool/system.rb +54 -36
- data/lib/mool/version.rb +1 -1
- data/mool.gemspec +32 -17
- metadata +72 -53
- data/lib/mool/load_average.rb +0 -13
- data/lib/mool/service.rb +0 -80
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
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2018 g.edera
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
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
|
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
|
-
>
|
35
|
+
> Mool::Cpu.all
|
30
36
|
[
|
31
|
-
[0] #<
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
>>
|
46
|
-
|
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
|
-
>>
|
54
|
-
{ :total_thread_entities => 638,
|
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
|
-
>>
|
61
|
-
{ :uptime_day => 4,
|
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
|
-
>>
|
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
|
-
>>
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
>>
|
125
|
-
>>
|
126
|
-
>>
|
127
|
-
>>
|
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
|
-
##
|
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
|
-
>>
|
135
|
-
#<
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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
|
-
>>
|
152
|
-
#<
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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
|
-
>>
|
181
|
-
#<
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
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
|
-
>>
|
363
|
+
>> Mool::Disk.new("sda").partitions
|
190
364
|
[
|
191
|
-
[0] #<
|
192
|
-
|
193
|
-
|
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
|
-
>>
|
407
|
+
>> Mool::Disk.new("sda3").slaves
|
200
408
|
[
|
201
|
-
[0] #<
|
202
|
-
|
203
|
-
|
204
|
-
|
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
|
-
>>
|
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
|
-
#<
|
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
|
-
|
604
|
+
3.0.0
|
339
605
|
|
340
606
|
License
|
341
607
|
----
|