sensu-plugins-aws 10.0.2 → 10.0.3

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: ffc8970beca5e82f16654912ba292c00ac3b41630d2c760b9e58b8997a0123e0
4
- data.tar.gz: 92513710dc37d66eadec1f96db1bf1311a3abe99b36f1e5cb150aae763489edb
3
+ metadata.gz: c4d374e51efee898a5c8a79b78b93b3ced3eb090c8a09e48b8258ecc6e5f4299
4
+ data.tar.gz: 304c60c4178e8bb39afd8c21da9e2cbeabfb97ab9ee6c75d5ae42d953722a887
5
5
  SHA512:
6
- metadata.gz: 0c66f41a60c18e489994b213ec6510edb6590d2761ec89d8056f9feac1cafca676a447a46aac7e645853c62588a8c157b4973635e042f9cd60ae2b92dcb12dc3
7
- data.tar.gz: bdc877b84bec60cc0d4e8a79380d4472641b5e4ddcdd34f15ffb3a26d421a1fa47cd1667c5e8beb0e3b0544a90ea37535ca6bf9f3b2a2bc531d546a333f16c3f
6
+ metadata.gz: ab9b02c01ece25c58a40e3b8a2dfef4df1c2b92b9a659ccfeb407a72e2c2ea87d7ab4a75cf493f06bf6f3902758a1e1ef956f4f6318edad9ad954b89dc1a8b3d
7
+ data.tar.gz: 4ef3f5844d954b354f8d1bf34c5a44939177829e26ba2657be9bf15235aff975daea91e4c52c76c8d4c97d21a4bbe98eceee118cbaee6ae1c1148d15d85b6bfb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [10.0.3] - 2017-12-03
9
+ ### Fixed
10
+ - metrics-asg.rb: fix dimension name, handle the --scheme flag, make the --statistic flag work, support autoscaling groups containing spaces in their name (@multani)
11
+
8
12
  ## [10.0.2] - 2017-12-02
9
13
  ### Fixed
10
14
  - check-beanstalk-elb-metric.rb, check-cloudwatch-metric.rb, check-cloudwatch-composite-metric.rb: fixed incorrect help message (@arthurlogilab)
@@ -402,7 +406,8 @@ WARNING: This release contains major breaking changes that will impact all user
402
406
  ### Added
403
407
  - initial release
404
408
 
405
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.2...HEAD
409
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.3...HEAD
410
+ [10.0.3]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.2...10.0.3
406
411
  [10.0.2]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.1...10.0.2
407
412
  [10.0.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.0...10.0.1
408
413
  [10.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/9.0.1...10.0.0
data/bin/metrics-asg.rb CHANGED
@@ -22,7 +22,7 @@
22
22
  #
23
23
  # NOTES:
24
24
  # Returns latency statistics by default. You can specify any valid ASG metric type, see
25
- # http://http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/as-metricscollected.html
25
+ # https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/as-metricscollected.html
26
26
  #
27
27
  # LICENSE:
28
28
  # Peter Hoppe <peter.hoppe.extern@bertelsmann.de>
@@ -45,8 +45,7 @@ class ASGMetrics < Sensu::Plugin::Metric::CLI::Graphite
45
45
  option :scheme,
46
46
  description: 'Metric naming scheme, text to prepend to metric',
47
47
  short: '-s SCHEME',
48
- long: '--scheme SCHEME',
49
- default: ''
48
+ long: '--scheme SCHEME'
50
49
 
51
50
  option :fetch_age,
52
51
  description: 'How long ago to fetch metrics for',
@@ -62,10 +61,10 @@ class ASGMetrics < Sensu::Plugin::Metric::CLI::Graphite
62
61
  default: 'GroupInServiceInstances'
63
62
 
64
63
  option :statistic,
65
- description: 'Statistics type',
64
+ description: 'Statistic type',
66
65
  short: '-t STATISTIC',
67
66
  long: '--statistic',
68
- default: ''
67
+ default: 'Sum'
69
68
 
70
69
  option :aws_region,
71
70
  short: '-r AWS_REGION',
@@ -101,7 +100,7 @@ class ASGMetrics < Sensu::Plugin::Metric::CLI::Graphite
101
100
  metric_name: metric_name,
102
101
  dimensions: [
103
102
  {
104
- name: 'AutoScaling',
103
+ name: 'AutoScalingGroupName',
105
104
  value: asg_name
106
105
  }
107
106
  ],
@@ -114,38 +113,39 @@ class ASGMetrics < Sensu::Plugin::Metric::CLI::Graphite
114
113
 
115
114
  def print_statistics(asg_name, statistics)
116
115
  result = {}
117
- static_value = {}
118
116
  statistics.each do |key, static|
119
117
  r = cloud_watch_metric(key, static, asg_name)
120
- static_value['AutoScalingGroup.' + asg_name + '.' + key + '.' + static] = static
121
- result['AutoScalingGroup.' + asg_name + '.' + key + '.' + static] = r[:datapoints][0] unless r[:datapoints][0].nil?
118
+ keys =
119
+ if config[:scheme].nil?
120
+ []
121
+ else
122
+ [config[:scheme]]
123
+ end
124
+ keys.concat ['AutoScalingGroup', asg_name.tr(' ', '_'), key, static]
125
+
126
+ result[keys.join('.')] = r[:datapoints].first unless r[:datapoints].first.nil?
122
127
  end
123
128
  result.each do |key, value|
124
- output key.downcase.to_s, value[static_value[key].downcase], value[:timestamp].to_i
129
+ output key.downcase.to_s, value[config[:statistic].downcase], value[:timestamp].to_i
125
130
  end
126
131
  end
127
132
 
128
133
  def run
129
- if config[:statistic] == ''
130
- default_statistic_per_metric = {
131
- 'GroupMinSize' => 'Sum',
132
- 'GroupMaxSize' => 'Sum',
133
- 'GroupDesiredCapacity' => 'Sum',
134
- 'GroupInServiceInstances' => 'Sum',
135
- 'GroupPendingInstances' => 'Sum',
136
- 'GroupStandbyInstances' => 'Sum',
137
- 'GroupTerminatingInstances' => 'Sum',
138
- 'GroupTotalInstances' => 'Sum'
139
- }
140
- statistic = default_statistic_per_metric
141
- else
142
- statistic = config[:statistic]
143
- end
134
+ statistic = {
135
+ 'GroupMinSize' => config[:statistic],
136
+ 'GroupMaxSize' => config[:statistic],
137
+ 'GroupDesiredCapacity' => config[:statistic],
138
+ 'GroupInServiceInstances' => config[:statistic],
139
+ 'GroupPendingInstances' => config[:statistic],
140
+ 'GroupStandbyInstances' => config[:statistic],
141
+ 'GroupTerminatingInstances' => config[:statistic],
142
+ 'GroupTotalInstances' => config[:statistic]
143
+ }
144
144
 
145
145
  begin
146
146
  if config[:asgname].nil?
147
- asg.describe_auto_scaling_groups.auto_scaling_groups.each do |autoascalinggroup|
148
- print_statistics(autoascalinggroup.auto_scaling_group_name, statistic)
147
+ asg.describe_auto_scaling_groups.auto_scaling_groups.each do |autoscalinggroup|
148
+ print_statistics(autoscalinggroup.auto_scaling_group_name, statistic)
149
149
  end
150
150
  else
151
151
  print_statistics(config[:asgname], statistic)
@@ -2,7 +2,7 @@ module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 10
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.2
4
+ version: 10.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors