bin/check-elb-latency.rb in sensu-plugins-aws-10.1.1 vs bin/check-elb-latency.rb in sensu-plugins-aws-10.1.2
- old
+ new
@@ -78,11 +78,11 @@
long: '--statistics NAME',
default: :average,
proc: proc { |a| a.downcase.intern },
description: 'CloudWatch statistics method'
- %w(warning critical).each do |severity|
+ %w[warning critical].each do |severity|
option :"#{severity}_over",
long: "--#{severity}-over SECONDS",
proc: proc(&:to_f),
description: "Trigger a #{severity} if latancy is over specified seconds"
end
@@ -132,14 +132,14 @@
def check_latency(elb)
metric = latency_metric elb.name
metric_value = begin
latest_value metric
- rescue
+ rescue StandardError
0
end
- @severities.keys.each do |severity|
+ @severities.each_key do |severity|
threshold = config[:"#{severity}_over"]
next unless threshold
next if metric_value < threshold
flag_alert severity,
"; #{elbs.size == 1 ? nil : "#{elb.inspect}'s"} Latency is #{sprintf '%.3f', metric_value} seconds. (expected lower than #{sprintf '%.3f', threshold})"