lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.9.9.5 vs lib/riemann/babbler/plugins/cpu.rb in riemann-babbler-0.9.9.6
- old
+ new
@@ -30,10 +30,15 @@
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} usage\n\n#{description}" } if fraction
+ # _total идет с трешхолдом, а все остальное без трешхолда
+ if cpu_number == '_total'
+ array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Cpu#{cpu_number} usage\n\n#{description}" } if fraction
+ else
+ array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Cpu#{cpu_number} usage\n\n#{description}", :state => 'ok' } if fraction
+ end
end
array
end
end