sensu-plugins-aws 7.0.1 → 7.1.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 +4 -4
- data/CHANGELOG.md +7 -2
- data/README.md +3 -0
- data/bin/check-alb-target-group-health.rb +96 -0
- data/lib/sensu-plugins-aws/version.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 642a5f59535c19e584bf6b5fc030bff2e58bb6e1
|
4
|
+
data.tar.gz: a8e1650f5e03e6db3b7cc4a3beab15927b5fe2e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 508d9dcc967f89eb6fddfd8f96f70cbd4b7b8d836a4279de77f4d929d72abe9c22ee6ed6d58b43964127570ab736b362bc4f2534565ad4ac79e28d549edcd53d
|
7
|
+
data.tar.gz: ee5ae8a6ad649711044044531daa82d7edcfa6a2c1d33220b6bb7eaf6d87959333e1106af923b1fb6fbde68c8bb198d45ff20afa8768d24b8e0737a78732b244
|
data/CHANGELOG.md
CHANGED
@@ -5,13 +5,17 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [7.1.0] - 2017-08-14
|
9
|
+
### Added
|
10
|
+
- Add `check-alb-target-group-health.rb` that checks the health of ALB target groups (@eheydrick)
|
11
|
+
|
8
12
|
## [7.0.1] - 2017-08-12
|
9
13
|
### Fixed
|
10
14
|
- check-cloudwatch-metric.rb, check-cloudwatch-composite-metric.rb: fixed defaults to work (@majormoses)
|
11
15
|
- check-cloudwatch-metric.rb: short option `-n` was conflicting with `no_data_ok` and `namespace` as `check-cloudwatch-composite-metric.rb` uses `-O` I opted for that for consistency (@majormoses)
|
12
16
|
|
13
17
|
### Changed
|
14
|
-
- check-cloudwatch-metric.rb, check-cloudwatch-composite-metric.rb: `self.parse_dimensions` and `dimension_string` were the same in both checks This fix was common
|
18
|
+
- check-cloudwatch-metric.rb, check-cloudwatch-composite-metric.rb: `self.parse_dimensions` and `dimension_string` were the same in both checks. This fix was common among both checks so I moved it into the module
|
15
19
|
|
16
20
|
## [7.0.0] - 2017-08-07
|
17
21
|
### Breaking Change
|
@@ -344,7 +348,8 @@ WARNING: This release contains major breaking changes that will impact all user
|
|
344
348
|
### Added
|
345
349
|
- initial release
|
346
350
|
|
347
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.0
|
351
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.1.0...HEAD
|
352
|
+
[7.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.0.1...7.1.0
|
348
353
|
[7.0.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.0.0...7.0.1
|
349
354
|
[7.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/6.3.0...7.0.0
|
350
355
|
[6.3.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/6.2.0...6.3.0
|
data/README.md
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
## Functionality
|
10
10
|
|
11
|
+
**check-alb-target-group-health.rb**
|
12
|
+
|
11
13
|
**check-asg-instances-created.rb**
|
12
14
|
|
13
15
|
**check-asg-instances-inservice.rb**
|
@@ -151,6 +153,7 @@
|
|
151
153
|
|
152
154
|
## Files
|
153
155
|
|
156
|
+
* /bin/check-alb-target-group-health.rb
|
154
157
|
* /bin/check-asg-instances-created.rb
|
155
158
|
* /bin/check-autoscaling-cpucredits.rb
|
156
159
|
* /bin/check-asg-instances-inservice.rb
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-alb-target-group-health
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks the health of Application Load Balancer target groups
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# plain-text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: aws-sdk
|
16
|
+
# gem: sensu-plugin
|
17
|
+
#
|
18
|
+
# USAGE:
|
19
|
+
# Check all target groups in a region
|
20
|
+
# check-alb-target-group-health.rb -r region
|
21
|
+
#
|
22
|
+
# Check a single target group in a region
|
23
|
+
# check-alb-target-group-health.rb -r region -t target-group
|
24
|
+
#
|
25
|
+
# Check multiple target groups in a region
|
26
|
+
# check-alb-target-group-health.rb -r region -t target-group-a,target-group-b
|
27
|
+
#
|
28
|
+
# LICENSE:
|
29
|
+
# Copyright 2017 Eric Heydrick <eheydrick@gmail.com>
|
30
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
31
|
+
# for details.
|
32
|
+
|
33
|
+
require 'aws-sdk'
|
34
|
+
require 'sensu-plugin/check/cli'
|
35
|
+
require 'sensu-plugins-aws'
|
36
|
+
|
37
|
+
class CheckALBTargetGroupHealth < Sensu::Plugin::Check::CLI
|
38
|
+
include Common
|
39
|
+
|
40
|
+
option :target_group,
|
41
|
+
short: '-t',
|
42
|
+
long: '--target-group TARGET_GROUP',
|
43
|
+
description: 'The ALB target group(s) to check. Separate multiple target groups with commas'
|
44
|
+
|
45
|
+
option :aws_region,
|
46
|
+
short: '-r AWS_REGION',
|
47
|
+
long: '--aws-region REGION',
|
48
|
+
description: 'AWS Region (defaults to us-east-1).',
|
49
|
+
default: 'us-east-1'
|
50
|
+
|
51
|
+
option :crit,
|
52
|
+
short: '-c',
|
53
|
+
long: '--crit',
|
54
|
+
description: 'Critical instead of warn when unhealthy targets are found',
|
55
|
+
boolean: true,
|
56
|
+
default: false
|
57
|
+
|
58
|
+
def alb
|
59
|
+
@alb ||= Aws::ElasticLoadBalancingV2::Client.new
|
60
|
+
end
|
61
|
+
|
62
|
+
def unhealthy_target_groups
|
63
|
+
unhealthy_groups = {}
|
64
|
+
|
65
|
+
target_groups_to_check = config[:target_group].split(',') if config[:target_group]
|
66
|
+
target_groups = alb.describe_target_groups(names: target_groups_to_check).target_groups
|
67
|
+
|
68
|
+
target_groups.each do |target_group|
|
69
|
+
health = alb.describe_target_health(target_group_arn: target_group.target_group_arn)
|
70
|
+
unhealthy_targets = health.target_health_descriptions.select { |t| t.target_health.state == 'unhealthy' }.map { |t| t.target.id }
|
71
|
+
unless unhealthy_targets.empty?
|
72
|
+
unhealthy_groups[target_group.target_group_name] = {
|
73
|
+
unhealthy_targets: unhealthy_targets,
|
74
|
+
total_targets: health.target_health_descriptions.size
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
unhealthy_groups
|
79
|
+
end
|
80
|
+
|
81
|
+
def run
|
82
|
+
unhealthy_groups = unhealthy_target_groups
|
83
|
+
|
84
|
+
if !unhealthy_groups.empty?
|
85
|
+
message = 'Unhealthy ALB target groups: '
|
86
|
+
message += unhealthy_groups.map { |target_group, value| "#{target_group} - #{value[:unhealthy_targets].size}/#{value[:total_targets]} unhealthy targets: {#{value[:unhealthy_targets].join(', ')}}" }.join(', ')
|
87
|
+
if config[:crit]
|
88
|
+
critical message
|
89
|
+
else
|
90
|
+
warning message
|
91
|
+
end
|
92
|
+
else
|
93
|
+
ok 'All ALB target groups are healthy'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
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: 7.0
|
4
|
+
version: 7.1.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: 2017-08-
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -256,6 +256,7 @@ description: |-
|
|
256
256
|
for EC2, SES, and SNS.
|
257
257
|
email: "<sensu-users@googlegroups.com>"
|
258
258
|
executables:
|
259
|
+
- check-alb-target-group-health.rb
|
259
260
|
- check-asg-instances-created.rb
|
260
261
|
- check-asg-instances-inservice.rb
|
261
262
|
- check-autoscaling-cpucredits.rb
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- CHANGELOG.md
|
338
339
|
- LICENSE
|
339
340
|
- README.md
|
341
|
+
- bin/check-alb-target-group-health.rb
|
340
342
|
- bin/check-asg-instances-created.rb
|
341
343
|
- bin/check-asg-instances-inservice.rb
|
342
344
|
- bin/check-autoscaling-cpucredits.rb
|