Sha256: ef6ebdfb7ef77bab190cb9cdd3ae99fa45af32c1182d00441a93f1f0855dedef

Contents?: true

Size: 449 Bytes

Versions: 1

Compression:

Stored size: 449 Bytes

Contents

=begin rdoc
  Basic memory monitor on the instance
=end
module PoolParty
  module Monitors
    module Memory
      def self.monitor!
        IO.popen("free -m | grep -i mem") { |io|
          ret = monitor_from_string(io)
        }
        ret
      end
      def self.monitor_from_string(str="")
        total_memory = str.split[1].to_f
        used_memory = str.split[2].to_f
        
        used_memory / total_memory
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
poolparty-0.0.4 lib/pool_party/monitors/memory.rb