lib/riemann/babbler/plugins/memory.rb in riemann-babbler-0.8.6 vs lib/riemann/babbler/plugins/memory.rb in riemann-babbler-0.8.7
- old
+ new
@@ -17,19 +17,20 @@
fraction = 1 - (free_bc.to_f / total)
swap_fraction = m['SwapTotal'] == 0 ? 0 : 1 - m['SwapFree'].to_f/m['SwapTotal']
desc = "#{shell('ps -eo pmem,pid,cmd --sort -pmem | head -10').chomp}"
+ spaces = " "
[
{ :service => plugin.service + " % free", :description => "Memory usage, %", :metric => fraction.round(2) * 100 },
{ :service => plugin.service + " % swap", :description => "Swap usage, %", :metric => swap_fraction.round(2) * 100 },
- { :service => plugin.service + " abs free", :description => "Memory free (kB)\n\n #{desc}", :metric => free, :state => 'ok' },
- { :service => plugin.service + " abs total", :description => "Memory total (kB)\n\n #{desc}", :metric => total, :state => 'ok' },
- { :service => plugin.service + " abs cached", :description => "Memory usage, cached (kB)\n\n #{desc}", :metric => cached, :state => 'ok' },
- { :service => plugin.service + " abs buffers", :description => "Memory usage, buffers (kB)\n\n #{desc}", :metric => buffers, :state => 'ok' },
- { :service => plugin.service + " abs used", :description => "Memory usage, used (kB)\n\n #{desc}", :metric => used , :state => 'ok' },
- { :service => plugin.service + " abs free_bc", :description => "Memory usage with cache и buffers (kB)\n\n #{desc}", :metric => free_bc , :state => 'ok' }
+ { :service => plugin.service + " abs free", :description => "Memory free (kB)#{spaces}\n\n #{desc}", :metric => free, :state => 'ok' },
+ { :service => plugin.service + " abs total", :description => "Memory total (kB)#{spaces}\n\n #{desc}", :metric => total, :state => 'ok' },
+ { :service => plugin.service + " abs cached", :description => "Memory usage, cached (kB)#{spaces}\n\n #{desc}", :metric => cached, :state => 'ok' },
+ { :service => plugin.service + " abs buffers", :description => "Memory usage, buffers (kB)#{spaces}\n\n #{desc}", :metric => buffers, :state => 'ok' },
+ { :service => plugin.service + " abs used", :description => "Memory usage, used (kB)#{spaces}\n\n #{desc}", :metric => used , :state => 'ok' },
+ { :service => plugin.service + " abs free_bc", :description => "Memory usage with cache и buffers (kB)#{spaces}\n\n #{desc}", :metric => free_bc , :state => 'ok' }
]
end
end