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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 775cb479d00b33c23dec30356cb9ff0e2545709b
4
- data.tar.gz: ea67eca91454c19caeea52318dbd5e9ba9ad57cf
3
+ metadata.gz: 55e6a72b4df60831148e9238f244ef139fe93b27
4
+ data.tar.gz: dd9e305450fafa1a8155d31f62cd34b91fe07234
5
5
  SHA512:
6
- metadata.gz: b4f8cf4def76fdbf0d60ff1eea89084078bb0c929cda4ba0a35d41ccdd09cd73bc2d3d93f11308f1e3c09afec67f93e700d5056aa7212501e05985eade4afd09
7
- data.tar.gz: 8fe6509d09b605a23c69d834fdb9dcb811e89e87682b3cc266acdcbe46b8720ff5f603a2e2de800cfb65deae5a6339bda5160fa2672e272ce7b8a20d1de3d751
6
+ metadata.gz: 063980ee0fc662dfc0666f3b8213c54ce2d936d3fe422853b873340d114785f57984007126427fcdfb95cec097310f88a3cf3f9a04eae356bbc7c29446bc78f2
7
+ data.tar.gz: 8b052639493a7bb7afe984d98a54aa90935dac3b4d494f3cc35529853d6c30f14d920f55d1f84acbc2951fd6ae052ca72d4a301ac630c5d32be0f2e0cf4eaf4f
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Silw
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -24,9 +24,13 @@ module Silw
24
24
 
25
25
  Authenticate.with(config) do |user|
26
26
  user.should be_instance_of(Command)
27
- mem = user.run :mem, :at => 'router', :fixture => fixture("mem.txt")
28
- expect(mem.keys).to include(:host)
29
- expect(mem[:mem].keys).to include(:free)
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.2
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 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler