sensu-plugins-aws 10.1.1 → 10.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/bin/check-asg-instances-created.rb +1 -1
  4. data/bin/check-asg-instances-inservice.rb +2 -2
  5. data/bin/check-beanstalk-elb-metric.rb +1 -1
  6. data/bin/check-beanstalk-health.rb +4 -4
  7. data/bin/check-cloudfront-tag.rb +2 -2
  8. data/bin/check-cloudwatch-alarm.rb +1 -2
  9. data/bin/check-cloudwatch-alarms.rb +1 -2
  10. data/bin/check-configservice-rules.rb +1 -1
  11. data/bin/check-dynamodb-capacity.rb +4 -4
  12. data/bin/check-dynamodb-throttle.rb +4 -4
  13. data/bin/check-ec2-cpu_balance.rb +2 -2
  14. data/bin/check-ec2-filter.rb +1 -1
  15. data/bin/check-ec2-network.rb +1 -1
  16. data/bin/check-ecs-service-health.rb +2 -2
  17. data/bin/check-elb-certs.rb +2 -2
  18. data/bin/check-elb-health-fog.rb +3 -3
  19. data/bin/check-elb-health-sdk.rb +1 -1
  20. data/bin/check-elb-health.rb +3 -3
  21. data/bin/check-elb-latency.rb +3 -3
  22. data/bin/check-elb-nodes.rb +1 -1
  23. data/bin/check-elb-sum-requests.rb +3 -3
  24. data/bin/check-emr-cluster.rb +1 -1
  25. data/bin/check-eni-status.rb +2 -2
  26. data/bin/check-instance-events.rb +5 -4
  27. data/bin/check-instance-health.rb +1 -1
  28. data/bin/check-instance-reachability.rb +1 -1
  29. data/bin/check-instances-count.rb +1 -1
  30. data/bin/check-kms-key.rb +1 -1
  31. data/bin/check-rds-events.rb +2 -3
  32. data/bin/check-rds-pending.rb +1 -1
  33. data/bin/check-rds.rb +5 -5
  34. data/bin/check-redshift-events.rb +2 -2
  35. data/bin/check-route.rb +1 -1
  36. data/bin/check-route53-domain-expiration.rb +3 -4
  37. data/bin/check-s3-bucket.rb +1 -1
  38. data/bin/check-s3-object.rb +3 -3
  39. data/bin/check-s3-tag.rb +2 -2
  40. data/bin/check-ses-limit.rb +1 -1
  41. data/bin/check-subnet-ip-consumption.rb +8 -3
  42. data/bin/check-trustedadvisor-service-limits.rb +1 -1
  43. data/bin/check-vpc-nameservers.rb +1 -1
  44. data/bin/check-vpc-vpn.rb +2 -2
  45. data/bin/handler-ec2_node.rb +1 -1
  46. data/bin/handler-scale-asg-down.rb +2 -2
  47. data/bin/handler-scale-asg-up.rb +2 -2
  48. data/bin/handler-sns.rb +1 -1
  49. data/bin/metrics-autoscaling-instance-count.rb +1 -1
  50. data/bin/metrics-billing.rb +1 -2
  51. data/bin/metrics-ec2-count.rb +1 -2
  52. data/bin/metrics-ec2-filter.rb +1 -1
  53. data/bin/metrics-elasticache.rb +2 -1
  54. data/bin/metrics-elb-full.rb +1 -1
  55. data/bin/metrics-emr-steps.rb +1 -1
  56. data/bin/metrics-rds.rb +1 -1
  57. data/bin/metrics-s3.rb +5 -3
  58. data/bin/metrics-sqs.rb +1 -1
  59. data/lib/sensu-plugins-aws/common.rb +4 -1
  60. data/lib/sensu-plugins-aws/version.rb +1 -1
  61. metadata +35 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aab932b622a455c57a0452d064e70eec97da6406360f1fdbb07fdc22947a16da
4
- data.tar.gz: 4b8ab5f873b2c36a57d1cf70bb56da5aeb35ead249e14cc319b7142b52bb2985
3
+ metadata.gz: 9563afe668b4a84ecb1d41560588231c94ea851d528cf725e9b4aeec4b2dd8d6
4
+ data.tar.gz: f457e971482d604d8b6817d827ce6c1db1ccea3c1106a89688cd60b4642311c2
5
5
  SHA512:
6
- metadata.gz: 2523108ce56e1a7c4d1745f6b7df570fe35406ab7330795fbc78fbc6204e3f282b7d89b658103e791c87572db422268e9680c8464411f989d14194f4cf37cb6f
7
- data.tar.gz: bf6d5e42ab154e9b3f3806adf88343bc47a2f2da9fc6c4cd7e80342c61b915e04dec1a3c6fcb045eb714c6a930d364a4887a3f1d61a6e775de304d6d08706efb
6
+ metadata.gz: 86f975041f3167beba850ef75e2b26e04cfa9f69ec737fe26d3528184d97c1e88df9b364552c1e3a54c74e6f5ed3e19e50d3dd35a4d74f895feb5d01d1fc193f
7
+ data.tar.gz: c331bbacf81e08ff41b2a6ea97c68d755d6dfd6b583fad824bf91017f8ba5585e85620545cb8fffcfd4e6ba7114bfe7e642ca5b21c83fcebeabd11893886bb57
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [10.1.2] - 2018-01-13
9
+ ### Security
10
+ - updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
11
+
12
+ ### Changed
13
+ - appease the new cops where it required light refactoring, called out TODO's for later refactoring (@majormoses)
14
+
8
15
  ## [10.1.1.] - 2018-01-13
9
16
  ### Fixed
10
17
  - check-instance-health.rb: fixed incorrect test operator from `&&` to `||` in `gather_events`, should reject if either case is true. (@randeffects)
@@ -13,6 +20,7 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
13
20
  - check-cloudwatch-composite-metric.rb: add flags `zero_denominator_data_ok`, `no_denominator_data_ok`, and `numerator_default` to add ability to allow numerator in composite to be 0. While leaving the functionality of `no_data_ok` the same, this change allows us to check to alert if the numerator has no data since 0/X is a valid alert case. (@zbintliff)
14
21
  - lib/cloudwatch-common.rb: added tests for majority of functions (@zbintliff)
15
22
 
23
+
16
24
  ## [10.0.3] - 2017-12-03
17
25
  ### Fixed
18
26
  - metrics-asg.rb: fix dimension name, handle the --scheme flag, make the --statistic flag work, support autoscaling groups containing spaces in their name (@multani)
@@ -415,6 +423,7 @@ WARNING: This release contains major breaking changes that will impact all user
415
423
  - initial release
416
424
 
417
425
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.1...HEAD
426
+ [10.1.2]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.1...10.1.2
418
427
  [10.1.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.0...10.1.1
419
428
  [10.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.0...10.0.3
420
429
  [10.0.3]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.2...10.0.3
@@ -116,7 +116,7 @@ class CheckAsgInstanceCreated < Sensu::Plugin::Check::CLI
116
116
  end
117
117
  end
118
118
  end
119
- if instance_terminating == 0 && instance_launching == 0
119
+ if instance_terminating.zero? && instance_launching.zero?
120
120
  ok 'No instances Launched & Terminated last hour'
121
121
  elsif instance_terminating >= critical && instance_launching >= critical
122
122
  critical "#{result_launched} \n #{result_terminated}"
@@ -70,7 +70,7 @@ class CheckAsgInstancesInService < Sensu::Plugin::Check::CLI
70
70
  instance_in_service += 1
71
71
  end
72
72
  end
73
- if instance_in_service == 0
73
+ if instance_in_service.zero?
74
74
  critical = 1
75
75
  result += "#{grp_name}: no Instances inService #{instance_in_service} \n"
76
76
  elsif instance_in_service < group.min_size
@@ -88,7 +88,7 @@ class CheckAsgInstancesInService < Sensu::Plugin::Check::CLI
88
88
  instance_in_service += 1
89
89
  end
90
90
  end
91
- if instance_in_service == 0
91
+ if instance_in_service.zero?
92
92
  critical = 1
93
93
  result += "#{config[:group]}: no Instances inService #{instance_in_service} \n"
94
94
  elsif instance_in_service < min_size
@@ -106,7 +106,7 @@ class BeanstalkELBCheck < Sensu::Plugin::Check::CLI
106
106
  .describe_environment_resources(environment_name: config[:environment])
107
107
  .environment_resources
108
108
  .load_balancers[config[:elb_idx]]
109
- .name
109
+ .name
110
110
  end
111
111
 
112
112
  def run
@@ -54,7 +54,7 @@ class BeanstalkHealth < Sensu::Plugin::Check::CLI
54
54
  @env_health ||= beanstalk_client
55
55
  .describe_environment_health(
56
56
  environment_name: config[:environment],
57
- attribute_names: %w(Color Status HealthStatus Causes)
57
+ attribute_names: %w[Color Status HealthStatus Causes]
58
58
  )
59
59
  end
60
60
 
@@ -72,13 +72,13 @@ class BeanstalkHealth < Sensu::Plugin::Check::CLI
72
72
  @instances_health ||= begin
73
73
  curr_instances = beanstalk_client.describe_instances_health(
74
74
  environment_name: config[:environment],
75
- attribute_names: %w(Color HealthStatus Causes)
75
+ attribute_names: %w[Color HealthStatus Causes]
76
76
  )
77
77
  instances = curr_instances.instance_health_list
78
78
  until curr_instances.next_token.nil?
79
79
  curr_instances = beanstalk_client.describe_instances_health(
80
80
  environment_name: config[:environment],
81
- attribute_names: %w(Color HealthStatus Causes)
81
+ attribute_names: %w[Color HealthStatus Causes]
82
82
  )
83
83
  instances.concat(curr_instances.instance_health_list)
84
84
  end
@@ -87,7 +87,7 @@ class BeanstalkHealth < Sensu::Plugin::Check::CLI
87
87
  end
88
88
 
89
89
  def unhealthy_instances
90
- @unhealthy_instances ||= instances_health.select { |i| i.color != 'Green' }
90
+ @unhealthy_instances ||= instances_health.reject { |i| i.color == 'Green' }
91
91
  end
92
92
 
93
93
  def status_rollup
@@ -54,7 +54,7 @@ class CheckCloudFrontTag < Sensu::Plugin::Check::CLI
54
54
  if keys.sort & tags.sort != tags.sort
55
55
  missing_tags.push distribution.id
56
56
  end
57
- rescue => _
57
+ rescue StandardError
58
58
  missing_tags.push distribution.id
59
59
  end
60
60
  end
@@ -64,7 +64,7 @@ class CheckCloudFrontTag < Sensu::Plugin::Check::CLI
64
64
  else
65
65
  critical("Missing tags in #{missing_tags}")
66
66
  end
67
- rescue => e
67
+ rescue StandardError => e
68
68
  critical "Error: #{e.message} - #{e.backtrace}"
69
69
  end
70
70
  end
@@ -95,8 +95,7 @@ class CloudWatchCheck < Sensu::Plugin::Check::CLI
95
95
  end
96
96
 
97
97
  ok message
98
-
99
- rescue => e
98
+ rescue StandardError => e
100
99
  puts "Error: exception: #{e}"
101
100
  critical
102
101
  end
@@ -70,8 +70,7 @@ class CloudWatchCheck < Sensu::Plugin::Check::CLI
70
70
  critical "#{alarms.size} in '#{config[:state]}' state: #{alarms.map(&:alarm_name).join(',')}" unless alarms.empty?
71
71
 
72
72
  ok 'everything looks good'
73
-
74
- rescue => e
73
+ rescue StandardError => e
75
74
  puts "Error: exception: #{e}"
76
75
  critical
77
76
  end
@@ -70,7 +70,7 @@ class CheckConfigServiceRules < Sensu::Plugin::Check::CLI
70
70
  else
71
71
  ok
72
72
  end
73
- rescue => e
73
+ rescue StandardError => e
74
74
  unknown "An error occurred processing AWS ConfigService API: #{e.message}"
75
75
  end
76
76
  end
@@ -84,11 +84,11 @@ class CheckDynamoDB < Sensu::Plugin::Check::CLI
84
84
  option :capacity_for,
85
85
  short: '-c N',
86
86
  long: '--capacity-for NAME',
87
- default: [:read, :write],
87
+ default: %i[read write],
88
88
  proc: proc { |a| a.split(/[,;]\s*/).map { |n| n.downcase.intern } },
89
89
  description: 'Read/Write (or both) capacity to check.'
90
90
 
91
- %w(warning critical).each do |severity|
91
+ %w[warning critical].each do |severity|
92
92
  option :"#{severity}_over",
93
93
  long: "--#{severity}-over N",
94
94
  # #YELLOW
@@ -156,12 +156,12 @@ class CheckDynamoDB < Sensu::Plugin::Check::CLI
156
156
  metric = cloud_watch_metric metric_name, table.table_name
157
157
  metric_value = begin
158
158
  latest_value(metric)
159
- rescue
159
+ rescue StandardError
160
160
  0
161
161
  end
162
162
  percentage = metric_value / table.provisioned_throughput.send("#{r_or_w}_capacity_units").to_f * 100
163
163
 
164
- @severities.keys.each do |severity|
164
+ @severities.each_key do |severity|
165
165
  threshold = config[:"#{severity}_over"]
166
166
  next unless threshold
167
167
  next if percentage < threshold
@@ -80,11 +80,11 @@ class CheckDynamoDB < Sensu::Plugin::Check::CLI
80
80
  option :throttle_for,
81
81
  short: '-c N',
82
82
  long: '--throttle-for NAME',
83
- default: [:read, :write],
83
+ default: %i[read write],
84
84
  proc: proc { |a| a.split(/[,;]\s*/).map { |n| n.downcase.intern } },
85
85
  description: 'Read/Write (or both) throttle to check.'
86
86
 
87
- %w(warning critical).each do |severity|
87
+ %w[warning critical].each do |severity|
88
88
  option :"#{severity}_over",
89
89
  long: "--#{severity}-over N",
90
90
  proc: proc(&:to_f),
@@ -151,11 +151,11 @@ class CheckDynamoDB < Sensu::Plugin::Check::CLI
151
151
  metric = cloud_watch_metric metric_name, table.table_name
152
152
  metric_value = begin
153
153
  latest_value(metric)
154
- rescue
154
+ rescue StandardError
155
155
  0
156
156
  end
157
157
 
158
- @severities.keys.each do |severity|
158
+ @severities.each_key do |severity|
159
159
  threshold = config[:"#{severity}_over"]
160
160
  next unless threshold
161
161
  next if metric_value < threshold
@@ -110,13 +110,13 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
110
110
  level = 2
111
111
  messages << "#{id}#{tag} is below critical threshold [#{result} < #{config[:critical]}]\n"
112
112
  elsif config[:warning] && result < config[:warning]
113
- level = 1 if level == 0
113
+ level = 1 if level.zero?
114
114
  messages << "#{id}#{tag} is below warning threshold [#{result} < #{config[:warning]}]\n"
115
115
  end
116
116
  end
117
117
  end
118
118
  end
119
- ok messages if level == 0
119
+ ok messages if level.zero?
120
120
  warning messages if level == 1
121
121
  critical messages if level == 2
122
122
  end
@@ -183,7 +183,7 @@ class EC2Filter < Sensu::Plugin::Check::CLI
183
183
  end
184
184
 
185
185
  ok message
186
- rescue => e
186
+ rescue StandardError => e
187
187
  puts "Error: exception: #{e}"
188
188
  critical
189
189
  end
@@ -73,7 +73,7 @@ class CheckEc2Network < Sensu::Plugin::Check::CLI
73
73
  default: 'NetworkIn',
74
74
  description: 'Select NetworkIn or NetworkOut'
75
75
 
76
- %w(warning critical).each do |severity|
76
+ %w[warning critical].each do |severity|
77
77
  option :"#{severity}_over",
78
78
  long: "--#{severity}-over COUNT",
79
79
  description: "Trigger a #{severity} if network traffice is over specified Bytes"
@@ -95,7 +95,7 @@ class CheckEcsServiceHealth < Sensu::Plugin::Check::CLI
95
95
  end
96
96
 
97
97
  def bucket_service(running_count, desired_count)
98
- if running_count == 0 && desired_count > 0
98
+ if running_count.zero? && desired_count > 0
99
99
  :critical
100
100
  elsif running_count < desired_count
101
101
  :warn
@@ -149,7 +149,7 @@ class CheckEcsServiceHealth < Sensu::Plugin::Check::CLI
149
149
  else
150
150
  ok
151
151
  end
152
- rescue => e
152
+ rescue StandardError => e
153
153
  unknown "An error occurred processing AWS ECS API: #{e.message}"
154
154
  end
155
155
  end
@@ -94,7 +94,7 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI
94
94
 
95
95
  begin
96
96
  http.start { cert = http.peer_cert }
97
- rescue => e
97
+ rescue StandardError => e
98
98
  critical "An issue occurred attempting to get cert: #{e.message}"
99
99
  end
100
100
 
@@ -111,7 +111,7 @@ class CheckELBCerts < Sensu::Plugin::Check::CLI
111
111
  end
112
112
  end
113
113
  end
114
- rescue => e
114
+ rescue StandardError => e
115
115
  unknown "An error occurred processing AWS ELB API: #{e.message}"
116
116
  end
117
117
 
@@ -76,7 +76,7 @@ class ELBHealth < Sensu::Plugin::Check::CLI
76
76
  instance_az = Net::HTTP.get(URI('http://169.254.169.254/latest/meta-data/placement/availability-zone/'))
77
77
  end
78
78
  instance_az[0...-1]
79
- rescue
79
+ rescue StandardError
80
80
  raise "Cannot obtain this instance's Availability Zone. Maybe not running on AWS?"
81
81
  end
82
82
 
@@ -87,7 +87,7 @@ class ELBHealth < Sensu::Plugin::Check::CLI
87
87
  end
88
88
 
89
89
  def run
90
- aws_region = (config[:aws_region].nil? || config[:aws_region].empty?) ? query_instance_region : config[:aws_region]
90
+ aws_region = config[:aws_region].nil? || config[:aws_region].empty? ? query_instance_region : config[:aws_region]
91
91
  begin
92
92
  elb = Fog::AWS::ELB.new aws_config
93
93
  if config[:instances]
@@ -107,7 +107,7 @@ class ELBHealth < Sensu::Plugin::Check::CLI
107
107
  else
108
108
  critical "Detected [#{unhealthy_instances.size}] unhealthy instances"
109
109
  end
110
- rescue => e
110
+ rescue StandardError => e
111
111
  warning "An issue occured while communicating with the AWS EC2 API: #{e.message}"
112
112
  end
113
113
  end
@@ -136,7 +136,7 @@ class ELBHealth < Sensu::Plugin::Check::CLI
136
136
  @message = ''
137
137
  critical = false
138
138
 
139
- unless config[:aws_region].casecmp('all') == 0
139
+ unless config[:aws_region].casecmp('all').zero?
140
140
  if aws_regions.include? config[:aws_region]
141
141
  aws_regions.clear.push(config[:aws_region])
142
142
  else
@@ -73,13 +73,13 @@ class ELBHealth < Sensu::Plugin::Check::CLI
73
73
  instance_az = Net::HTTP.get(URI('http://169.254.169.254/latest/meta-data/placement/availability-zone/'))
74
74
  end
75
75
  instance_az[0...-1]
76
- rescue
76
+ rescue StandardError
77
77
  raise "Cannot obtain this instance's Availability Zone. Maybe not running on AWS?"
78
78
  end
79
79
 
80
80
  def run
81
81
  begin
82
- aws_region = (config[:aws_region].nil? || config[:aws_region].empty?) ? query_instance_region : config[:aws_region]
82
+ aws_region = config[:aws_region].nil? || config[:aws_region].empty? ? query_instance_region : config[:aws_region]
83
83
  elb = RightAws::ElbInterface.new(config[:aws_access_key], config[:aws_secret_access_key],
84
84
  logger: Logger.new('/dev/null'),
85
85
  cache: false,
@@ -90,7 +90,7 @@ class ELBHealth < Sensu::Plugin::Check::CLI
90
90
  else
91
91
  health = elb.describe_instance_health(config[:elb_name])
92
92
  end
93
- rescue => e
93
+ rescue StandardError => e
94
94
  critical "An issue occured while communicating with the AWS EC2 API: #{e.message}"
95
95
  end
96
96
  # #YELLOW
@@ -80,7 +80,7 @@ class CheckELBLatency < Sensu::Plugin::Check::CLI
80
80
  proc: proc { |a| a.downcase.intern },
81
81
  description: 'CloudWatch statistics method'
82
82
 
83
- %w(warning critical).each do |severity|
83
+ %w[warning critical].each do |severity|
84
84
  option :"#{severity}_over",
85
85
  long: "--#{severity}-over SECONDS",
86
86
  proc: proc(&:to_f),
@@ -134,11 +134,11 @@ class CheckELBLatency < Sensu::Plugin::Check::CLI
134
134
  metric = latency_metric elb.name
135
135
  metric_value = begin
136
136
  latest_value metric
137
- rescue
137
+ rescue StandardError
138
138
  0
139
139
  end
140
140
 
141
- @severities.keys.each do |severity|
141
+ @severities.each_key do |severity|
142
142
  threshold = config[:"#{severity}_over"]
143
143
  next unless threshold
144
144
  next if metric_value < threshold
@@ -116,7 +116,7 @@ class CheckELBNodes < Sensu::Plugin::Check::CLI
116
116
  critical 'ELB has no nodes'
117
117
  elsif state['Unknown'].count == num_instances
118
118
  unknown 'All nodes in unknown state'
119
- elsif state['InService'].count == 0
119
+ elsif state['InService'].count.zero?
120
120
  critical message
121
121
  elsif config[:crit_under] > 0 && config[:crit_under] >= state['InService'].count
122
122
  critical message
@@ -72,7 +72,7 @@ class CheckELBSumRequests < Sensu::Plugin::Check::CLI
72
72
  proc: proc(&:to_i),
73
73
  description: 'CloudWatch metric statistics period'
74
74
 
75
- %w(warning critical).each do |severity|
75
+ %w[warning critical].each do |severity|
76
76
  option :"#{severity}_over",
77
77
  long: "--#{severity}-over COUNT",
78
78
  proc: proc(&:to_f),
@@ -126,11 +126,11 @@ class CheckELBSumRequests < Sensu::Plugin::Check::CLI
126
126
  metric = latency_metric elb.name
127
127
  metric_value = begin
128
128
  latest_value metric
129
- rescue
129
+ rescue StandardError
130
130
  0
131
131
  end
132
132
 
133
- @severities.keys.each do |severity|
133
+ @severities.each_key do |severity|
134
134
  threshold = config[:"#{severity}_over"]
135
135
  puts metric_value
136
136
  next unless threshold
@@ -137,7 +137,7 @@ class CheckEMRCluster < Sensu::Plugin::Check::CLI
137
137
  ok "EMR cluster #{config[:cluster_name]} - #{humanize(age)}"
138
138
  end
139
139
  end
140
- rescue => e
140
+ rescue StandardError => e
141
141
  critical "EMR cluster #{config[:cluster_name]} - #{e.message}"
142
142
  end
143
143
  end
@@ -92,9 +92,9 @@ class ENIStatus < Sensu::Plugin::Check::CLI
92
92
 
93
93
  if status.nil?
94
94
  warnings << "No Information found for #{e}"
95
- elsif config[:crit_status].casecmp(status[:status]) == 0
95
+ elsif config[:crit_status].casecmp(status[:status]).zero?
96
96
  crits << "#{e} is #{status[:status]}"
97
- elsif config[:warn_status].casecmp(status[:status]) == 0
97
+ elsif config[:warn_status].casecmp(status[:status]).zero?
98
98
  warnings << "#{e} is #{status[:status]}"
99
99
  end
100
100
  end
@@ -83,7 +83,7 @@ class CheckInstanceEvents < Sensu::Plugin::Check::CLI
83
83
 
84
84
  aws_regions = ec2_regions
85
85
 
86
- unless config[:aws_region].casecmp('all') == 0
86
+ unless config[:aws_region].casecmp('all').zero?
87
87
  if aws_regions.include? config[:aws_region]
88
88
  aws_regions.clear.push(config[:aws_region])
89
89
  else
@@ -96,7 +96,8 @@ class CheckInstanceEvents < Sensu::Plugin::Check::CLI
96
96
  aws_config[:secret_access_key] = config[:aws_secret_access_key]
97
97
  end
98
98
 
99
- aws_regions.each do |r| # Iterate each possible region
99
+ # TODO: come back and refactor this
100
+ aws_regions.each do |r| # Iterate each possible region # rubocop:disable Metrics/BlockLength)
100
101
  ec2 = Aws::EC2::Client.new(aws_config.merge!(region: r))
101
102
  begin
102
103
  describe_instance_options = {}
@@ -127,7 +128,7 @@ class CheckInstanceEvents < Sensu::Plugin::Check::CLI
127
128
  instance_desc = ec2.describe_instances(instance_ids: [i[:instance_id]])
128
129
  name_tag = instance_desc.reservations[0].instances[0].tags.find { |tag| tag[:key] == 'Name' }
129
130
  name = name_tag.nil? ? '' : name_tag.value
130
- rescue => e
131
+ rescue StandardError => e
131
132
  puts "Issue getting instance details for #{i[:instance_id]} (#{r}). Exception = #{e}"
132
133
  end
133
134
  end
@@ -139,7 +140,7 @@ class CheckInstanceEvents < Sensu::Plugin::Check::CLI
139
140
  end
140
141
  end
141
142
  end
142
- rescue => e
143
+ rescue StandardError => e
143
144
  unknown "An error occurred processing AWS EC2 API (#{r}): #{e.message}"
144
145
  end
145
146
  end