sensu-plugins-aws-boutetnico 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/check-alb-target-group-health.rb +28 -0
- data/lib/sensu-plugins-aws/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2a10855b93b31564af58f86c27f72de712191c5f037df52dc742538acfed984
|
4
|
+
data.tar.gz: 6b5a92561b5ac979f06cd1cdacc97593a1e9838c3f508fd2c8f20908d4b67d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e59d8f558e7b293eef240679a68f7681c1a9c7ed443a3183bffa1347dd47d9bb4498b4d42f25ae58eca29f0a3ebdefd3b345b4742db72242c051e822021c44e
|
7
|
+
data.tar.gz: 1958f736c2e8846f0d2082f7246bce9d149e24c9b4cc57bfe38c3446422a4c0249a470245162567c92c920db767afa6524397354643649af44f64302a0bd80d5
|
@@ -25,10 +25,17 @@
|
|
25
25
|
# Check multiple target groups in a region
|
26
26
|
# check-alb-target-group-health.rb -r region -t target-group-a,target-group-b
|
27
27
|
#
|
28
|
+
# Check multiple target groups starting with a prefix in name
|
29
|
+
# check-alb-target-group-health.rb -r region -p prod
|
30
|
+
#
|
31
|
+
# Check multiple target groups starting with a prefix in name and excluding by name
|
32
|
+
# check-alb-target-group-health.rb -r region -p prod -e staging,dev
|
33
|
+
#
|
28
34
|
# LICENSE:
|
29
35
|
# Copyright 2017 Eric Heydrick <eheydrick@gmail.com>
|
30
36
|
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
31
37
|
# for details.
|
38
|
+
# Modified by Nicolas Boutet <amd3002@gmail.com>
|
32
39
|
|
33
40
|
require 'aws-sdk'
|
34
41
|
require 'sensu-plugin/check/cli'
|
@@ -55,6 +62,19 @@ class CheckALBTargetGroupHealth < Sensu::Plugin::Check::CLI
|
|
55
62
|
boolean: true,
|
56
63
|
default: false
|
57
64
|
|
65
|
+
option :name_prefix,
|
66
|
+
description: 'Target group name prefix',
|
67
|
+
short: '-p NAME_PREFIX',
|
68
|
+
long: '--name-prefix NAME_PREFIX',
|
69
|
+
default: ''
|
70
|
+
|
71
|
+
option :exclude,
|
72
|
+
description: 'Exclude target groups by name',
|
73
|
+
short: '-e EXCLUDE',
|
74
|
+
long: '--exclude',
|
75
|
+
proc: proc { |a| a.split(',') },
|
76
|
+
default: []
|
77
|
+
|
58
78
|
def alb
|
59
79
|
@alb ||= Aws::ElasticLoadBalancingV2::Client.new
|
60
80
|
end
|
@@ -65,6 +85,14 @@ class CheckALBTargetGroupHealth < Sensu::Plugin::Check::CLI
|
|
65
85
|
target_groups_to_check = config[:target_group].split(',') if config[:target_group]
|
66
86
|
target_groups = alb.describe_target_groups(names: target_groups_to_check).target_groups
|
67
87
|
|
88
|
+
unless config[:name_prefix].empty?
|
89
|
+
target_groups.keep_if { |target_group| target_group.target_group_name.start_with?(config[:name_prefix]) }
|
90
|
+
end
|
91
|
+
|
92
|
+
config[:exclude].each do |x|
|
93
|
+
target_groups.delete_if { |target_group| target_group.target_group_name.match(x) }
|
94
|
+
end
|
95
|
+
|
68
96
|
target_groups.each do |target_group|
|
69
97
|
health = alb.describe_target_health(target_group_arn: target_group.target_group_arn)
|
70
98
|
unhealthy_targets = health.target_health_descriptions.select { |t| t.target_health.state == 'unhealthy' }.map { |t| t.target.id }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-aws-boutetnico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|