Module: Memory::Remote

Defined in:
lib/poolparty/monitors/memory.rb

Instance Method Summary collapse

Instance Method Details

#memoryObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/poolparty/monitors/memory.rb', line 15

def memory
  out = begin
    str = run("free -m | grep -i mem")

    total_memory = str.split[1].to_f
    used_memory = str.split[2].to_f

    used_memory / total_memory
  rescue Exception => e
    0.0
  end
  PoolParty.message "Memory: #{out}"
  out  
end