lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.8.5 vs lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.8.6

- old
+ new

@@ -1,11 +1,11 @@ #encoding: utf-8 class Riemann::Babbler::Cpu < Riemann::Babbler def desc - "usage\n\n#{shell('ps -eo pcpu,pid,cmd --sort -pcpu | head -10').chomp}" + "#{shell('ps -eo pcpu,pid,cmd --sort -pcpu | head -10').chomp}" end def init @old_cpu = Hash.new end @@ -30,10 +30,10 @@ total = used + i2-i1 fraction = used.to_f / total end @old_cpu[cpu_number] = [u2, n2, s2, i2] - array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Cpu#{cpu_number} utilization\n\n" + description } if fraction + array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Cpu#{cpu_number} utilization\n\n#{description}" } if fraction end array end end