silw 0.0.2 → 0.1.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 +4 -4
- data/lib/silw/plugins/mem.rb +4 -4
- data/lib/silw/version.rb +1 -1
- data/spec/silw_spec.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e6a72b4df60831148e9238f244ef139fe93b27
|
4
|
+
data.tar.gz: dd9e305450fafa1a8155d31f62cd34b91fe07234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 063980ee0fc662dfc0666f3b8213c54ce2d936d3fe422853b873340d114785f57984007126427fcdfb95cec097310f88a3cf3f9a04eae356bbc7c29446bc78f2
|
7
|
+
data.tar.gz: 8b052639493a7bb7afe984d98a54aa90935dac3b4d494f3cc35529853d6c30f14d920f55d1f84acbc2951fd6ae052ca72d4a301ac630c5d32be0f2e0cf4eaf4f
|
data/lib/silw/plugins/mem.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/sftp'
|
|
3
3
|
module Silw
|
4
4
|
module Plugins
|
5
5
|
|
6
|
-
# Meminfo - report the memory stats collected from a remote system.
|
6
|
+
# Meminfo - report the memory stats collected from a remote system, in bytes, rather than KBytes.
|
7
7
|
# For more details about meminfo see this featured article: /proc/meminfo Explained, at:
|
8
8
|
# - http://www.redhat.com/advice/tips/meminfo.html
|
9
9
|
#
|
@@ -26,9 +26,9 @@ module Silw
|
|
26
26
|
private
|
27
27
|
def parse_meminfo(txt)
|
28
28
|
meminfo = txt.split(/\n/).collect{|x| x.strip}
|
29
|
-
memtotal = meminfo[0].gsub(/[^0-9]/, "").to_f
|
30
|
-
memfree = meminfo[1].gsub(/[^0-9]/, "").to_f
|
31
|
-
memactive = meminfo[5].gsub(/[^0-9]/, "").to_f
|
29
|
+
memtotal = 1_024 * meminfo[0].gsub(/[^0-9]/, "").to_f
|
30
|
+
memfree = 1_024 * meminfo[1].gsub(/[^0-9]/, "").to_f
|
31
|
+
memactive = 1_024 * meminfo[5].gsub(/[^0-9]/, "").to_f
|
32
32
|
{:total => memtotal.round, :active => memactive.round, :free => memfree.round,
|
33
33
|
:usagepercentage => ((memactive * 100) / memtotal).round}
|
34
34
|
end
|
data/lib/silw/version.rb
CHANGED
data/spec/silw_spec.rb
CHANGED
@@ -24,9 +24,13 @@ module Silw
|
|
24
24
|
|
25
25
|
Authenticate.with(config) do |user|
|
26
26
|
user.should be_instance_of(Command)
|
27
|
-
|
28
|
-
expect(
|
29
|
-
|
27
|
+
mem_hash = user.run :mem, :at => 'router', :fixture => fixture("mem.txt")
|
28
|
+
expect(mem_hash.keys).to include(:host)
|
29
|
+
mem = mem_hash[:mem]
|
30
|
+
expect(mem.keys).to include(:free)
|
31
|
+
|
32
|
+
# expecting the mem plugin to return memory info in bytes
|
33
|
+
expect(mem[:total]).to eq(2_075_624 * 1_024)
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florin T.PATRASCU
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|