vmstator 1.0.0 → 1.0.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -1
- data/lib/vmstator/version.rb +1 -1
- data/lib/vmstator.rb +4 -3
- data/pkg/vmstator-1.0.0.gem +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa6c931304074e4c5c866858e3375f027dd5f0f3
|
4
|
+
data.tar.gz: de2d4a841bee588b785a95f4ef1319a3cd830e39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35f05ee3a7786b3383d0a6518f4bd3ec74b9de987e73f1392a344cd42edbf6d43c09b9ca1c6d29d9e04394e879ee6c6d991ddc7d54326d69936f022ba6237a90
|
7
|
+
data.tar.gz: 8a1a67389fbf481222a3111a9be3a16cea5432b4c292e4f3a5c06286cde667858aaf59f11831d7c9133c4d8faacb22b9ff63a8ffebedcaf423f91b5e007880c6
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Vmstator is a Ruby API for [vmstat](https://en.wikipedia.org/wiki/Vmstat). It pr
|
|
6
6
|
|
7
7
|
This gem is still in development, but has more or less working code! :)
|
8
8
|
|
9
|
-

|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -37,6 +37,18 @@ Still working on this bit, but, for the mean time...
|
|
37
37
|
```ruby
|
38
38
|
require 'vmstator'
|
39
39
|
|
40
|
+
vmstats = Vmstator::Stats.new
|
41
|
+
vmstats.flags = "-S M"
|
42
|
+
vmstats.parse
|
43
|
+
|
44
|
+
puts vmstats.data
|
45
|
+
puts vmstats.buffer
|
46
|
+
puts vmstats.cache
|
47
|
+
puts vmstats.forks
|
48
|
+
puts vmstats.active
|
49
|
+
puts vmstats.disk_info
|
50
|
+
puts vmstats.event_counter_statistics
|
51
|
+
puts vmstats.slab_info
|
40
52
|
```
|
41
53
|
|
42
54
|
## License
|
data/lib/vmstator/version.rb
CHANGED
data/lib/vmstator.rb
CHANGED
@@ -81,6 +81,7 @@ module Vmstator
|
|
81
81
|
# informatio from that command.
|
82
82
|
def disk_info
|
83
83
|
@disk_info = {}
|
84
|
+
@disk_info[:disks] = {}
|
84
85
|
output = `vmstat -d`.split("\n")
|
85
86
|
# remove first two lines of the output
|
86
87
|
output.shift
|
@@ -88,8 +89,8 @@ module Vmstator
|
|
88
89
|
@disk_info[:disk_count] = output.count
|
89
90
|
output.each do |line|
|
90
91
|
disk, total, merged, sectors, ms, total, merged, sectors, ms, cur, sec = line.split
|
91
|
-
@disk_info[disk
|
92
|
-
|
92
|
+
@disk_info[:disks][disk] = { :totoal => total, :merged => merged, :sectors => sectors,
|
93
|
+
:ms => ms, :cur => cur, :sec => sec }
|
93
94
|
end
|
94
95
|
@disk_info
|
95
96
|
end
|
@@ -97,7 +98,7 @@ module Vmstator
|
|
97
98
|
# event_counter_statistics() will return the event
|
98
99
|
# count statistics in the form of a hash
|
99
100
|
def event_counter_statistics(flags=@flags)
|
100
|
-
output = `vmstat #{flags}
|
101
|
+
output = `vmstat #{flags}`
|
101
102
|
keys = output.split(/\d/).compact.join.split("\n").map(&:strip)
|
102
103
|
values = output.split(/[A-z]/).compact.join.split("\n").map(&:strip)
|
103
104
|
Hash[keys.zip values]
|
data/pkg/vmstator-1.0.0.gem
CHANGED
Binary file
|