lib/riemann/babbler/plugins/memory.rb in riemann-babbler-0.5.8 vs lib/riemann/babbler/plugins/memory.rb in riemann-babbler-0.5.9

- old
+ new

@@ -4,13 +4,13 @@ m = File.read('/proc/meminfo').split(/\n/).inject({}) { |info, line| x = line.split(/:?\s+/) info[x[0]] = x[1].to_i info } - free = m['MemFree'].to_i - cached =m['Cached'].to_i - buffers =m['Buffers'].to_i - total = m['MemTotal'].to_i + free = m['MemFree'].to_i * 1024 + cached =m['Cached'].to_i * 1024 + buffers =m['Buffers'].to_i * 1024 + total = m['MemTotal'].to_i * 1024 used = total - free free_bc = free + buffers + cached fraction = 1 - (free.to_f / total) swap_fraction = m['SwapTotal'] == 0 ? 0 : 1 - m['SwapFree'].to_f/m['SwapTotal']