Sha256: 62500687cc9bd80fbf3742c5eca8a5893a8f9d363047ab9bc11e69e6a581fc72

Contents?: true

Size: 415 Bytes

Versions: 20

Compression:

Stored size: 415 Bytes

Contents

module PoolParty
  module Monitors
    
    class MemoryMonitor < BaseMonitor
      
      def run
        str = %x[free -m | grep -i mem]
        begin
          total_memory = str.split[1].to_f
          used_memory = str.split[2].to_f

          used_memory / total_memory
        rescue Exception => e
          0.0
        end
        
      end
            
    end
    
    register_monitor :memory
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
auser-poolparty-0.2.15 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.16 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.20 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.21 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.22 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.23 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.24 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.25 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.26 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.35 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.36 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.37 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.38 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.39 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.40 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.41 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.42 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.44 lib/poolparty/monitors/monitors/memory_monitor.rb
auser-poolparty-0.2.45 lib/poolparty/monitors/monitors/memory_monitor.rb
poolparty-0.2.18 lib/poolparty/monitors/monitors/memory_monitor.rb