sensu-plugins-aws 10.2.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a16969efd75d8180a047d23203b50d8def65e1fa1195c0d9aa01ad33d0fac551
4
- data.tar.gz: 27dfefdff63801d47729edc185c112d1bc78027760338442b914431b75446d04
3
+ metadata.gz: cf38e747e9eacaf74e5266c61fb6425729e033b72258e95a97c2c2c3bfafaa6e
4
+ data.tar.gz: ac749130f70447fc122f00613424793ea1f699184bccc1bee71de020a75c0c84
5
5
  SHA512:
6
- metadata.gz: 40bb528c7369ebac03a58c8a550c9cf691996bd1cb35d48e5c82907033c342abb611129cd95a76e8653d7e9d17644e71d71a7cbb26a026f1c8ea84e90acee557
7
- data.tar.gz: 840436086db63a6e42b8c86d51c30c92d942efb25f2cd8451d199cc07f7205ec7a0a98a8d24f3ed71585a88349d05c19dd29bd520df2444f548bdb74c86f7eb6
6
+ metadata.gz: 88e750cb8957949dcf0d9d235f182e5327841b9dac8aa0fe53689012a2a7dbd6c49d4f5591d95284175d45aaff0a66115b7569ba4e7bcd05841937a348598447
7
+ data.tar.gz: b923084b699ebb9a26ac5e11632573a79d9ff432b6de1b5434d2ca027283d017ae611517981b6656435bf5a5f7d83232c39e4fc44dfc1fdac63db71b185c1854
@@ -5,6 +5,15 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [11.0.0] - 2018-02-09
9
+ ### Breaking Changes
10
+ - metrics-elb-full.rb: removed in favor of metrics-elb.rb, which is slightly more configurable and uses the AWS-SDK v2 already. Compared to metrics-elb-full.rb, metrics-elb.rb no longer takes --aws-access-key, --aws-secret-access-key flags, Authentication should be configured per [here](https://github.com/sensu-plugins/sensu-plugins-aws/blob/master/README.md#authentication). --scheme has a default value of `elb` now (@multani)
11
+ - metrics-elb.rb: honors the --fetch_age flag which now looks up values 60 seconds in the past by default. This was the intended behavior, as documented in the NOTES section (@multani)
12
+ - metrics-elb.rb: --scheme default value is `elb` now, to be more consistent with the other metrics checks (@multani)
13
+
14
+ ### Fixed
15
+ - metrics-elb.rb: properly handle the --scheme and --fetch_age flags (@multani)
16
+
8
17
  ## [10.2.0] - 2018-01-20
9
18
  ### Added
10
19
  - `check-s3-bucket-visiblity.rb` - checks an S3 bucket for existence of a website configuration or bucket policy containing `Get*`,
@@ -427,7 +436,8 @@ WARNING: This release contains major breaking changes that will impact all user
427
436
  ### Added
428
437
  - initial release
429
438
 
430
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.2.0...HEAD
439
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.0.0...HEAD
440
+ [11.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.2.0...11.0.0
431
441
  [10.2.0]:https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.2...10.2.0
432
442
  [10.1.2]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.1...10.1.2
433
443
  [10.1.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.1.0...10.1.1
@@ -52,7 +52,7 @@ class ELBMetrics < Sensu::Plugin::Metric::CLI::Graphite
52
52
  description: 'Metric naming scheme, text to prepend to metric',
53
53
  short: '-s SCHEME',
54
54
  long: '--scheme SCHEME',
55
- default: ''
55
+ default: 'elb'
56
56
 
57
57
  option :fetch_age,
58
58
  description: 'How long ago to fetch metrics for',
@@ -106,8 +106,8 @@ class ELBMetrics < Sensu::Plugin::Metric::CLI::Graphite
106
106
  }
107
107
  ],
108
108
  statistics: [value],
109
- start_time: config[:end_time] - config[:period],
110
- end_time: config[:end_time],
109
+ start_time: config[:end_time] - config[:fetch_age] - config[:period],
110
+ end_time: config[:end_time] - config[:fetch_age],
111
111
  period: config[:period]
112
112
  )
113
113
  end
@@ -117,8 +117,16 @@ class ELBMetrics < Sensu::Plugin::Metric::CLI::Graphite
117
117
  static_value = {}
118
118
  statistics.each do |key, static|
119
119
  r = cloud_watch_metric(key, static, load_balancer_name)
120
- static_value['loadbalancer.' + load_balancer_name + '.' + key + '.' + static] = static
121
- result['loadbalancer.' + load_balancer_name + '.' + key + '.' + static] = r[:datapoints][0] unless r[:datapoints][0].nil?
120
+ keys = if config[:scheme] == ''
121
+ []
122
+ else
123
+ [config[:scheme]]
124
+ end
125
+ keys.concat [load_balancer_name, key, static]
126
+ metric_key = keys.join('.')
127
+
128
+ static_value[metric_key] = static
129
+ result[metric_key] = r[:datapoints][0] unless r[:datapoints][0].nil?
122
130
  end
123
131
  result.each do |key, value|
124
132
  output key.downcase.to_s, value[static_value[key].downcase], value[:timestamp].to_i
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
- MAJOR = 10
4
- MINOR = 2
3
+ MAJOR = 11
4
+ MINOR = 0
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: 10.2.0
4
+ version: 11.0.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: 2018-01-20 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -326,7 +326,6 @@ executables:
326
326
  - metrics-ec2-count.rb
327
327
  - metrics-ec2-filter.rb
328
328
  - metrics-elasticache.rb
329
- - metrics-elb-full.rb
330
329
  - metrics-elb.rb
331
330
  - metrics-emr-steps.rb
332
331
  - metrics-rds.rb
@@ -409,7 +408,6 @@ files:
409
408
  - bin/metrics-ec2-count.rb
410
409
  - bin/metrics-ec2-filter.rb
411
410
  - bin/metrics-elasticache.rb
412
- - bin/metrics-elb-full.rb
413
411
  - bin/metrics-elb.rb
414
412
  - bin/metrics-emr-steps.rb
415
413
  - bin/metrics-rds.rb
@@ -447,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
447
445
  version: '0'
448
446
  requirements: []
449
447
  rubyforge_project:
450
- rubygems_version: 2.7.4
448
+ rubygems_version: 2.7.5
451
449
  signing_key:
452
450
  specification_version: 4
453
451
  summary: Sensu plugins for working with an AWS environment
@@ -1,145 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # elb-full-metrics
4
- #
5
- # DESCRIPTION:
6
- # Gets latency metrics from CloudWatch and puts them in Graphite for longer term storage
7
- #
8
- # OUTPUT:
9
- # metric-data
10
- #
11
- # PLATFORMS:
12
- # Linux
13
- #
14
- # DEPENDENCIES:
15
- # gem: aws-sdk-v1
16
- # gem: sensu-plugin
17
- #
18
- # USAGE:
19
- # #YELLOW
20
- #
21
- # NOTES:
22
- # Returns latency statistics by default. You can specify any valid ELB metric type, see
23
- # http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html#elb-metricscollected
24
- #
25
- # By default fetches statistics from one minute ago. You may need to fetch further back than this;
26
- # high traffic ELBs can sometimes experience statistic delays of up to 10 minutes. If you experience this,
27
- # raising a ticket with AWS support should get the problem resolved.
28
- # As a workaround you can use eg -f 300 to fetch data from 5 minutes ago.
29
- #
30
- # LICENSE:
31
- # Copyright 2013 Bashton Ltd http://www.bashton.com/
32
- # Released under the same terms as Sensu (the MIT license); see LICENSE
33
- # for details.
34
- #
35
-
36
- require 'sensu-plugin/metric/cli'
37
- require 'aws-sdk-v1'
38
-
39
- class ELBMetrics < Sensu::Plugin::Metric::CLI::Graphite
40
- option :elbname,
41
- description: 'Name of the Elastic Load Balancer (separate with commas for multiple ELBs)',
42
- short: '-n ELB_NAME',
43
- long: '--name ELB_NAME',
44
- required: true
45
-
46
- option :scheme,
47
- description: 'Metric naming scheme, text to prepend to metric',
48
- short: '-s SCHEME',
49
- long: '--scheme SCHEME',
50
- default: ''
51
-
52
- option :fetch_age,
53
- description: 'How long ago to fetch metrics for',
54
- short: '-f AGE',
55
- long: '--fetch_age',
56
- default: 60,
57
- proc: proc(&:to_i)
58
-
59
- option :aws_access_key,
60
- short: '-a AWS_ACCESS_KEY',
61
- long: '--aws-access-key AWS_ACCESS_KEY',
62
- description: "AWS Access Key. Either set ENV['AWS_ACCESS_KEY'] or provide it as an option",
63
- default: ENV['AWS_ACCESS_KEY']
64
-
65
- option :aws_secret_access_key,
66
- short: '-k AWS_SECRET_KEY',
67
- long: '--aws-secret-access-key AWS_SECRET_KEY',
68
- description: "AWS Secret Access Key. Either set ENV['AWS_SECRET_KEY'] or provide it as an option",
69
- default: ENV['AWS_SECRET_KEY']
70
-
71
- option :aws_region,
72
- short: '-r AWS_REGION',
73
- long: '--aws-region REGION',
74
- description: 'AWS Region (defaults to us-east-1).',
75
- default: 'us-east-1'
76
-
77
- def aws_config
78
- { access_key_id: config[:aws_access_key],
79
- secret_access_key: config[:aws_secret_access_key],
80
- region: config[:aws_region] }
81
- end
82
-
83
- def run
84
- statistic_type = {
85
- 'Latency' => 'Average',
86
- 'RequestCount' => 'Sum',
87
- 'UnHealthyHostCount' => 'Average',
88
- 'HealthyHostCount' => 'Average',
89
- 'HTTPCode_Backend_2XX' => 'Sum',
90
- 'HTTPCode_Backend_3XX' => 'Sum',
91
- 'HTTPCode_Backend_4XX' => 'Sum',
92
- 'HTTPCode_Backend_5XX' => 'Sum',
93
- 'HTTPCode_ELB_4XX' => 'Sum',
94
- 'HTTPCode_ELB_5XX' => 'Sum',
95
- 'BackendConnectionErrors' => 'Sum',
96
- 'SurgeQueueLength' => 'Maximum',
97
- 'SpilloverCount' => 'Sum'
98
- }
99
-
100
- begin
101
- et = Time.now - config[:fetch_age]
102
- st = et - 60
103
-
104
- cw = AWS::CloudWatch::Client.new aws_config
105
-
106
- options = {
107
- 'namespace' => 'AWS/ELB',
108
- 'dimensions' => [
109
- {
110
- 'name' => 'LoadBalancerName',
111
- 'value' => nil
112
- }
113
- ],
114
- 'start_time' => st.iso8601,
115
- 'end_time' => et.iso8601,
116
- 'period' => 60
117
- }
118
- config[:elbname].split(',').each do |elbname|
119
- graphitepath = if config[:scheme] == ''
120
- elbname.to_s
121
- else
122
- "#{config[:scheme]}.#{elbname}"
123
- end
124
- result = {}
125
- statistic_type.each do |key, value|
126
- options['metric_name'] = key
127
- options['dimensions'][0]['value'] = elbname
128
- options['statistics'] = [value]
129
- r = cw.get_metric_statistics(options)
130
- result[key] = r[:datapoints][0] unless r[:datapoints][0].nil?
131
- end
132
-
133
- # We only return data when we have some to return
134
- next if result.nil?
135
- result.each do |key, value|
136
- puts key, value
137
- output graphitepath + ".#{key}", value[:sum] || value[:average], value[:timestamp].to_i
138
- end
139
- end
140
- rescue StandardError => e
141
- critical "Error: exception: #{e}"
142
- end
143
- ok
144
- end
145
- end