sensu-plugins-aws 10.0.2 → 10.0.3
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 +4 -4
- data/CHANGELOG.md +6 -1
- data/bin/metrics-asg.rb +27 -27
- data/lib/sensu-plugins-aws/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4d374e51efee898a5c8a79b78b93b3ced3eb090c8a09e48b8258ecc6e5f4299
|
4
|
+
data.tar.gz: 304c60c4178e8bb39afd8c21da9e2cbeabfb97ab9ee6c75d5ae42d953722a887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
#
|
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: '
|
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: '
|
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
|
-
|
121
|
-
|
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[
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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 |
|
148
|
-
print_statistics(
|
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)
|