bin/check-dynamodb-throttle.rb in sensu-plugins-aws-10.1.1 vs bin/check-dynamodb-throttle.rb in sensu-plugins-aws-10.1.2
- old
+ new
@@ -78,15 +78,15 @@
description: 'CloudWatch statistics method'
option :throttle_for,
short: '-c N',
long: '--throttle-for NAME',
- default: [:read, :write],
+ default: %i[read write],
proc: proc { |a| a.split(/[,;]\s*/).map { |n| n.downcase.intern } },
description: 'Read/Write (or both) throttle to check.'
- %w(warning critical).each do |severity|
+ %w[warning critical].each do |severity|
option :"#{severity}_over",
long: "--#{severity}-over N",
proc: proc(&:to_f),
description: "Trigger a #{severity} if throttle is over the given number"
end
@@ -149,14 +149,14 @@
config[:throttle_for].each do |r_or_w|
metric_name = "#{r_or_w.to_s.capitalize}ThrottleEvents"
metric = cloud_watch_metric metric_name, table.table_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, "; On table #{table.table_name} #{r_or_w.to_s.capitalize}ThrottleEvents is #{metric_value} (higher_than #{threshold})"
break