sensu-plugins-aws 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGMyOTMzMDljMzFjOTExZTdkZDhkOWNkOGUyN2I4ZjY1Yzk0MTRmNw==
4
+ MjZiZDczN2YwYTQ3NTkzZGYwYTNmYjY0ODg4MzA0NTJlYTlmODNlMQ==
5
5
  data.tar.gz: !binary |-
6
- YzAyNzdkM2EwOWM0M2YzOTdjZGViOTMyMWRmMjg1Zjc4NGQ1OTEwNA==
6
+ NGNmMjZjMzZiN2YwYjNmOTA3OGZmZjE1MWVlYjU1ZDljZTk4NTMxNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGJhNjQ5ODEwZDZiMTUxNmFkOWQxNzZjODJjZGI2YmNlMDk2NGY3Zjc2YmQ3
10
- ZDA1ZDQwNWE0Y2IxZTBhNzUwZjYyZDdkYzk3NzMxMzhkOWNkOTY3MzNlYTI2
11
- OWYwYzBhZTVmMTFkNjU1MzU5Y2UyMjdlOTNmMDExZjg2MzE4OTg=
9
+ NGY2MjMxZTdlYmNhNzk1NzUzZjQ5YWE5MGIyYzNhMGNlYTdmOTM4MzBkNWEx
10
+ NTkwZDI5NDlhZTQ3OWI0N2RmZTc3ZTA1NjE4Y2IxY2I4ZDNhNTdhNDg0ZWFj
11
+ NTE0NTY5N2RhNDc5ZTkyZWFhZmE0ZjRlMmIzN2M5YWY4NzJmODY=
12
12
  data.tar.gz: !binary |-
13
- NjE1NDA1Mzc0NjdlNDYxMWJjZWM5OWJjYzBlZDI4NGNjODMyOTI1OGQyYTFl
14
- ZTllNzBkODViMWMyNzA0MzEyZDQwYjY4YjkzNTc4YTNmYTZlZTgwMWRkNTg4
15
- ZjE1NjY2NmNhNThhZmU1YjIwODRhNjM0YzhjMDk3ODBlZGFhOTU=
13
+ MzQ0YWU2MjE2NWMyYmM1NWM0OGFhMjg5ZjlhYmUwN2RkZjFiMjJjMGQ3NDdl
14
+ YTY1N2ZhMzJlMzE5ZWRjMzRhMDVjYTk1NWE1NzQyYTU5MDRmZWU5NDVkODUy
15
+ YmQwYzRlZjFkM2UzNDA2YTNmYjBjYzc3NzhiZWYyMDRlMDhmODE=
data/CHANGELOG.md CHANGED
@@ -5,11 +5,22 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.3.0] - 2016-03-18
9
+ ### Added
10
+ - Implemented metrics for EMR cluster steps
11
+ - Implemented check for EMR cluster failed steps
12
+
13
+ ### Changed
14
+ - Update to aws-sdk 2.2.28
15
+
16
+ ### Fixed
17
+ - check-cloudwatch-metric.rb: removed invalid .length.empty? check
18
+
8
19
  ## [2.2.0] - 2016-02-25
9
20
  ### Added
10
21
  - check-ebs-snapshots.rb: added -i flag to ignore volumes with an IGNORE_BACKUP tag
11
- - check-sensu-client.rb Ensures that ec2 instances are registered with Sensu.
12
- - check-trustedadvisor-service-limits.rb: New check for service limits based on Trusted Advisor API
22
+ - check-sensu-client.rb Ensures that ec2 instances are registered with Sensu.
23
+ - check-trustedadvisor-service-limits.rb: New check for service limits based on Trusted Advisor API
13
24
  - check-sqs-messages.rb,metrics-sqs.rb: Allow specifying queues by prefix with -p option
14
25
  - check-rds-events.rb: Add option to check a specific RDS instance
15
26
  - Add plugin check-elasticache-failover.rb that checks if an Elasticache node is in the primary state
@@ -136,7 +147,8 @@ WARNING: This release contains major breaking changes that will impact all user
136
147
  ### Added
137
148
  - initial release
138
149
 
139
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/2.2.0...HEAD
150
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/2.3.0...HEAD
151
+ [2.3.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/v2.2.0...2.3.0
140
152
  [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/v2.1.1...2.2.0
141
153
  [2.1.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/2.1.0...v2.1.1
142
154
  [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/2.0.1...2.1.0
data/README.md CHANGED
@@ -48,6 +48,8 @@
48
48
 
49
49
  **check-emr-cluster.rb**
50
50
 
51
+ **check-emr-steps.rb**
52
+
51
53
  **check-instance-events.rb**
52
54
 
53
55
  **check-instance-health.rb**
@@ -90,6 +92,8 @@
90
92
 
91
93
  **metrics-elb.rb**
92
94
 
95
+ **metrics-emr-steps.rb**
96
+
93
97
  **metrics-sqs.rb**
94
98
 
95
99
 
@@ -113,6 +117,7 @@
113
117
  * /bin/check-elb-nodes.rb
114
118
  * /bin/check-elb-sum-requests.rb
115
119
  * /bin/check-emr-cluster.rb
120
+ * /bin/check-emr-steps.rb
116
121
  * /bin/check-instance-events.rb
117
122
  * /bin/check-rds-events.rb
118
123
  * /bin/check-rds.rb
@@ -132,6 +137,7 @@
132
137
  * /bin/metrics-elasticache.rb
133
138
  * /bin/metrics-elb-full.rb
134
139
  * /bin/metrics-elb.rb
140
+ * /bin/metrics-emr-steps.rb
135
141
  * /bin/metrics-sqs.rb
136
142
 
137
143
  ## Usage
@@ -0,0 +1,78 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-emr-steps
4
+ #
5
+ # DESCRIPTION:
6
+ # Alerts on any failed steps for a cluster in the past 10 minutes.
7
+ #
8
+ # OUTPUT:
9
+ # plain-text
10
+ #
11
+ #
12
+ # DEPENDENCIES:
13
+ # gem: aws-sdk
14
+ # gem: sensu-plugin
15
+ #
16
+ # USAGE:
17
+ # check-emr-steps.rb -r us-west-2 -b 'My Cluster'
18
+ #
19
+ # This will alert on any failed steps in the past 10 minutes on the latest cluster
20
+ # with the name 'My Cluster'.
21
+ # NOTES:
22
+ #
23
+ # LICENSE:
24
+ # Bryan Absher <bryan.absher@gmail.com>
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+
28
+ require 'sensu-plugins-aws'
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'aws-sdk'
31
+
32
+ class CheckEMRSteps < Sensu::Plugin::Metric::CLI::Graphite
33
+ include Common
34
+
35
+ option :scheme,
36
+ description: 'Metric naming scheme, text to prepend to metric',
37
+ short: '-s SCHEME',
38
+ long: '--scheme SCHEME',
39
+ default: 'sensu.aws.emr'
40
+
41
+ option :aws_region,
42
+ short: '-r AWS_REGION',
43
+ long: '--aws-region REGION',
44
+ description: 'AWS Region (defaults to us-east-1).',
45
+ default: 'us-east-1'
46
+
47
+ option :cluster_name,
48
+ short: '-b CLUSTER_NAME',
49
+ long: '--cluster-name',
50
+ description: 'The name of the EMR cluster',
51
+ required: true
52
+
53
+ def run
54
+ emr = Aws::EMR::Client.new(aws_config)
55
+ begin
56
+ emr_clusters = emr.list_clusters.clusters
57
+ clusters = emr_clusters.select { |c| c.name == config[:cluster_name] }
58
+ critical "EMR cluster #{config[:cluster_name]} not found" if clusters.empty?
59
+ cluster = clusters.sort_by { |c| c.status.timeline.creation_date_time }.reverse.first
60
+
61
+ steps = emr.list_steps(
62
+ cluster_id: cluster.id,
63
+ step_states: ['FAILED']
64
+ ).steps
65
+
66
+ messages = []
67
+ now = Time.new
68
+ failed = steps.select { |step| now - step.status.timeline.end_date_time < 10 * 60 }
69
+ failed.each_entry { |step| messages << "Step #{step.id} '#{step.name}' has failed on cluster #{cluster.id} '#{cluster.name}'" }
70
+
71
+ if messages.count > 0
72
+ critical("#{messages.count} #{messages.count > 1 ? 'steps have' : 'step has'} failed: #{messages.join(',')}")
73
+ else
74
+ ok
75
+ end
76
+ end
77
+ end
78
+ end
@@ -22,7 +22,7 @@
22
22
  # NOTES:
23
23
  #
24
24
  # LICENSE:
25
- # Copyright (c) 2014, Tim Smith, tim@cozy.co
25
+ # Copyright (c) 2014, Tim Smith, tsmith@chef.io
26
26
  # Released under the same terms as Sensu (the MIT license); see LICENSE
27
27
  # for details.
28
28
  #
@@ -35,7 +35,7 @@
35
35
  # NOTES:
36
36
  #
37
37
  # LICENSE:
38
- # Tim Smith <tim@cozy.co>
38
+ # Tim Smith <tsmith@chef.io>
39
39
  # Released under the same terms as Sensu (the MIT license); see LICENSE
40
40
  # for details.
41
41
  #
@@ -29,7 +29,7 @@
29
29
  # NOTES:
30
30
  #
31
31
  # LICENSE:
32
- # Copyright (c) 2014, Tim Smith, tim@cozy.co
32
+ # Copyright (c) 2014, Tim Smith, tsmith@chef.io
33
33
  # Released under the same terms as Sensu (the MIT license); see LICENSE
34
34
  # for details.
35
35
  #
@@ -0,0 +1,81 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-emr-steps
4
+ #
5
+ # DESCRIPTION:
6
+ # Lists steps in EMR cluster queue with their status.
7
+ #
8
+ # OUTPUT:
9
+ # plain-text
10
+ #
11
+ #
12
+ # DEPENDENCIES:
13
+ # gem: aws-sdk
14
+ # gem: sensu-plugin
15
+ #
16
+ # USAGE:
17
+ # metric-emr-steps.rb -r us-west-2 -b 'prod lateral train'
18
+ #
19
+ # This will list out the counts for each step status for the entire history of the cluster.
20
+ #
21
+ # NOTES:
22
+ #
23
+ # LICENSE:
24
+ # Bryan Absher <bryan.absher@gmail.com>
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+
28
+ require 'sensu-plugins-aws'
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'aws-sdk'
31
+
32
+ class EMRStepMetrics < Sensu::Plugin::Metric::CLI::Graphite
33
+ include Common
34
+
35
+ option :scheme,
36
+ description: 'Metric naming scheme, text to prepend to metric',
37
+ short: '-s SCHEME',
38
+ long: '--scheme SCHEME',
39
+ default: 'sensu.aws.emr'
40
+
41
+ option :aws_region,
42
+ short: '-r AWS_REGION',
43
+ long: '--aws-region REGION',
44
+ description: 'AWS Region (defaults to us-east-1).',
45
+ default: 'us-east-1'
46
+
47
+ option :cluster_name,
48
+ short: '-b CLUSTER_NAME',
49
+ long: '--cluster-name',
50
+ description: 'The name of the EMR cluster',
51
+ required: true
52
+
53
+ def count(steps, status)
54
+ steps.count { |step| step.status.state == status }
55
+ end
56
+
57
+ STATUS = %w(PENDING RUNNING COMPLETED CANCELLED FAILED INTERRUPTED).freeze
58
+
59
+ def cluster_steps(emr, cluster_id, data)
60
+ steps = emr.list_steps(
61
+ cluster_id: cluster_id
62
+ ).steps
63
+ STATUS.each_entry { |s| data[s] += count(steps, s) }
64
+ end
65
+
66
+ def run
67
+ emr = Aws::EMR::Client.new(aws_config)
68
+ begin
69
+ emr_clusters = emr.list_clusters.clusters
70
+ clusters = emr_clusters.select { |c| c.name == config[:cluster_name] }
71
+ critical "EMR cluster #{config[:cluster_name]} not found" if clusters.empty?
72
+ cluster = clusters.sort_by { |c| c.status.timeline.creation_date_time }.reverse.first
73
+ data = {}
74
+ STATUS.each_entry { |status| data[status] = 0 }
75
+ cluster_steps(emr, cluster.id, data)
76
+ safe_name = config[:cluster_name].tr(' ', '_')
77
+ STATUS.each_entry { |status| output config[:scheme] + '.' + safe_name + '.step.' + status, data[status] }
78
+ end
79
+ ok
80
+ end
81
+ end
@@ -10,7 +10,7 @@ module CloudwatchCommon
10
10
  end
11
11
 
12
12
  def resp_has_no_data(resp, stats)
13
- resp.datapoints.nil? || resp.datapoints.length.empty? || resp.datapoints.first.nil? || read_value(resp, stats).nil?
13
+ resp.datapoints.nil? || resp.datapoints.empty? || resp.datapoints.first.nil? || read_value(resp, stats).nil?
14
14
  end
15
15
 
16
16
  def compare(value, threshold, compare_method)
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.11
19
+ version: 2.2.28
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.11
26
+ version: 2.2.28
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk-v1
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +248,7 @@ executables:
248
248
  - check-elb-nodes.rb
249
249
  - check-elb-sum-requests.rb
250
250
  - check-emr-cluster.rb
251
+ - check-emr-steps.rb
251
252
  - check-instance-events.rb
252
253
  - check-instance-health.rb
253
254
  - check-rds-events.rb
@@ -270,6 +271,7 @@ executables:
270
271
  - metrics-elasticache.rb
271
272
  - metrics-elb-full.rb
272
273
  - metrics-elb.rb
274
+ - metrics-emr-steps.rb
273
275
  - metrics-sqs.rb
274
276
  extensions: []
275
277
  extra_rdoc_files: []
@@ -298,6 +300,7 @@ files:
298
300
  - bin/check-elb-nodes.rb
299
301
  - bin/check-elb-sum-requests.rb
300
302
  - bin/check-emr-cluster.rb
303
+ - bin/check-emr-steps.rb
301
304
  - bin/check-instance-events.rb
302
305
  - bin/check-instance-health.rb
303
306
  - bin/check-rds-events.rb
@@ -321,6 +324,7 @@ files:
321
324
  - bin/metrics-elasticache.rb
322
325
  - bin/metrics-elb-full.rb
323
326
  - bin/metrics-elb.rb
327
+ - bin/metrics-emr-steps.rb
324
328
  - bin/metrics-sqs.rb
325
329
  - lib/sensu-plugins-aws.rb
326
330
  - lib/sensu-plugins-aws/cloudwatch-common.rb