lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.8.2 vs lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.8.3
- old
+ new
@@ -1,9 +1,11 @@
+#encoding: utf-8
+
class Riemann::Babbler::Cpu < Riemann::Babbler
def desc
- "usage\n\n#{shell('ps -eo pcpu,pid,cmd | sort -nrb -k1 | head -10').chomp}"
+ "usage\n\n#{shell('ps -eo pcpu,pid,cmd --sort -pcpu | head -10').chomp}"
end
def init
@old_cpu = Hash.new
end
@@ -28,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 => description } if fraction
+ array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Утилизация cpu#{cpu_number} \n\n" + description } if fraction
end
array
end
end