sensu-plugins-aws 3.2.1 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f76b3d361f86aba6404b7feec0fb0a539c905ee1
4
- data.tar.gz: d4c41a184fbceac2538a6b74e055c672342b0916
3
+ metadata.gz: c485509a9d40dee7713b4225ede97470a3f0cefb
4
+ data.tar.gz: 9e8c41bcc8f9694fd3703b3c76d6707f381fe69a
5
5
  SHA512:
6
- metadata.gz: a1508eaa5d15d324188474c38bb248f57dd58f413913e8e39975648416347d809e4b3de01f6c39c45695d7b72fd5fe4285289f6f8e42bf99b94a96da61c4465a
7
- data.tar.gz: 899da9812e7855ae89f970a27447d0d89f0ba5eb13d478e4c7201ab7fdbc1ecbaba34118c395714ee72fb548ec4e3952f76b85e1bed327c6962c7b12287bc7f8
6
+ metadata.gz: d28050bd2fe7ca47eca3d4117217d53bd3a5f4670d3aa8fc266a9cbee270047a658a57a4a8ffdee241001d9a5e09db0c0bf4a8c2da87e45d0c3be48d34962b66
7
+ data.tar.gz: 9edec98c9020e813eefe61855430aa79e68fab69af5a6ff683ee92c6a0dbd397a217c4f284ec182728f9a72fa0809f6f29ba5a5f0cd23ab90362f4ed5970ccb4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,49 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.0.0] - 2016-12-27
9
+ ### Breaking Changes
10
+ - `check-sqs-messages.rb`, `check-vpc-vpn.rb`, and `metrics-elb.rb` were updated to aws-sdk v2 and no longer take `aws_access_key` and `aws_secret_access_key` options.
11
+ Credentials should be set in environment variables, a credential file, or with an IAM instance profile.
12
+ See http://docs.aws.amazon.com/sdkforruby/api/#Configuration for details on setting credentials
13
+
14
+ ### Added
15
+ - check-cloudwatch-alarm.rb: Add region support (@ptqa)
16
+ - metrics-s3.rb: added (@obazoud)
17
+ - metrics-billing.rb: added (@obazoud)
18
+ - add check-cloudfront-tag.rb and check-s3-tag.rb (@obazoud)
19
+ - check-s3-object.rb: add an option to check s3 object's size (@obazoud)
20
+ - check-ebs-burst-limit.rb: added (@nyxcharon)
21
+ - check-sqs-messages.rb: added support for checking different metric types (@majormoses)
22
+ - check-rds.rb: Support added for Aurora Clusters (@daanemanz)
23
+ - check-vpc-vpn.rb: added warning/critical flags (@bootswithdefer)
24
+ - add check-route53-domain-expiration.rb that checks when domains registered in Route53 are close to expiration (@eheydrick)
25
+ - check-ec2-filter.rb: Add exclude tags option (@obazoud)
26
+ - add metrics-rds.rb (@phoppe93)
27
+ - check-instance-health.rb: Add support for filters (@AlexKulbiy)
28
+ - check-rds.rb: Support added for checking all databases in a region (@sstarcher)
29
+ - check-ecs-service-health.rb: Add `primary_status` option to limit checks to primary deployments (@matthew-watson1)
30
+ - Add check-asg-instances-created.rb to check for recent autoscaling events (@phoppe93)
31
+ - Add check-asg-instances-inservice.rb to check autoscaling group size (@phoppe93)
32
+ - Add check-elb-instances-inservice.rb to check service status of ELB instances (@phoppe93)
33
+ - Add metrics-asg.rb to grab metrics from autoscaling groups (@phoppe93)
34
+
35
+ ### Fixed
36
+ - check-ses-limits.rb: Fix percentage calculation (@eheydrick)
37
+ - check-ec2-cpu_balance.rb: fix warning and critical message (@mool)
38
+ - check-instance-events.rb: fixed missing events code; instance-reboot (@TorPeeto)
39
+ - check-instances-count.rb: fixed issues related to aws sdk version bump (@majormoses)
40
+ - metrics-elb-full.rb: Fix output (@obazoud)
41
+ - Fix cloudwatch imports (@nyxcharon)
42
+
43
+ ### Changed
44
+ - check-sqs-messages.rb: upgrade to aws-sdk v2 (@majormoses)
45
+ - check-vpc-vpn: upgrade to aws-sdk v2 (@phoppe93)
46
+ - check-instance-events.rb: migrated the script to aws sdk v2 because of incompatibility of sdk v1 with newer regions (@oba11)
47
+ - check-rds-events.rb: migrated the script to aws sdk v2 because of incompatibility of sdk v1 with newer regions (@oba11)
48
+ - metrics-autoscaling-instance-count.rb: migrated the script to aws sdk v2 and support fetching all autoscaling groups (@oba11)
49
+ - metrics-elb.rb: upgrade to aws-sdk v2 (@phoppe93)
50
+
8
51
  ## [3.2.1] - 2016-08-10
9
52
  ### Fixed
10
53
  - check-instance-health.rb: fixed remediated events not working after resolving it (@oba11)
@@ -232,7 +275,8 @@ WARNING: This release contains major breaking changes that will impact all user
232
275
  ### Added
233
276
  - initial release
234
277
 
235
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/3.2.1..HEAD
278
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/4.0.0...HEAD
279
+ [4.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/3.2.1...4.0.0
236
280
  [3.2.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/3.2.0...3.2.1
237
281
  [3.2.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/3.1.0...3.2.0
238
282
  [3.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/3.0.0...3.1.0
data/README.md CHANGED
@@ -8,6 +8,10 @@
8
8
 
9
9
  ## Functionality
10
10
 
11
+ **check-asg-instances-created.rb**
12
+
13
+ **check-asg-instances-inservice.rb**
14
+
11
15
  **check-autoscaling-cpucredits.rb**
12
16
 
13
17
  **check-beanstalk-elb-metric.rb**
@@ -16,6 +20,8 @@
16
20
 
17
21
  **check-cloudwatch-alarm**
18
22
 
23
+ **check-cloudfront-tag**
24
+
19
25
  **check-configservice-rules**
20
26
 
21
27
  **check-dynamodb-capacity.rb**
@@ -24,6 +30,8 @@
24
30
 
25
31
  **check-ebs-snapshots.rb**
26
32
 
33
+ **check-ebs-burst-limit.rb**
34
+
27
35
  **check-ec2-cpu_balance.rb**
28
36
 
29
37
  **check-ec2-filter.rb**
@@ -44,6 +52,8 @@
44
52
 
45
53
  **check-elb-health.rb**
46
54
 
55
+ **check-elb-instances-inservice.rb**
56
+
47
57
  **check-elb-latency.rb**
48
58
 
49
59
  **check-elb-nodes.rb**
@@ -70,10 +80,14 @@
70
80
 
71
81
  **check-reserved-instances.rb**
72
82
 
83
+ **check-route53-domain-expiration.rb**
84
+
73
85
  **check-s3-bucket.rb**
74
86
 
75
87
  **check-s3-object.rb**
76
88
 
89
+ **check-s3-tag.rb**
90
+
77
91
  **check-ses-limit.rb**
78
92
 
79
93
  **check-ses-statistics.rb**
@@ -102,8 +116,12 @@
102
116
 
103
117
  **handler-sns.rb**
104
118
 
119
+ **metrics-asg.rb**
120
+
105
121
  **metrics-autoscaling-instance-count.rb**
106
122
 
123
+ **metrics-billing.rb**
124
+
107
125
  **metrics-ec2-count.rb**
108
126
 
109
127
  **metrics-ec2-filter.rb**
@@ -116,6 +134,10 @@
116
134
 
117
135
  **metrics-emr-steps.rb**
118
136
 
137
+ **metrics-rds.rb**
138
+
139
+ **metrics-s3.rb**
140
+
119
141
  **metrics-ses.rb**
120
142
 
121
143
  **metrics-sqs.rb**
@@ -123,13 +145,17 @@
123
145
 
124
146
  ## Files
125
147
 
148
+ * /bin/check-asg-instances-created.rb
126
149
  * /bin/check-autoscaling-cpucredits.rb
150
+ * /bin/check-asg-instances-inservice.rb
127
151
  * /bin/check-beanstalk-elb-metric.rb
128
152
  * /bin/check-certificate-expiry.rb
129
153
  * /bin/check-configservice-rules.rb
154
+ * /bin/check-cloudfront-tag.rb
130
155
  * /bin/check-cloudwatch-alarm.rb
131
156
  * /bin/check-dynamodb-capacity.rb
132
157
  * /bin/check-dynamodb-throttle.rb
158
+ * /bin/check-ebs-burst-limit.rb
133
159
  * /bin/check-ebs-snapshots.rb
134
160
  * /bin/check-ec2-filter.rb
135
161
  * /bin/check-ec2-network.rb
@@ -139,6 +165,7 @@
139
165
  * /bin/check-elb-health-fog.rb
140
166
  * /bin/check-elb-health-sdk.rb
141
167
  * /bin/check-elb-health.rb
168
+ * /bin/check-elb-instances-inservice.rb
142
169
  * /bin/check-elb-latency.rb
143
170
  * /bin/check-elb-nodes.rb
144
171
  * /bin/check-elb-sum-requests.rb
@@ -149,7 +176,9 @@
149
176
  * /bin/check-rds-pending.rb
150
177
  * /bin/check-rds.rb
151
178
  * /bin/check-redshift-events.rb
179
+ * /bin/check-route53-domain-expiration.rb
152
180
  * /bin/check-s3-object.rb
181
+ * /bin/check-s3-tag.rb
153
182
  * /bin/check-ses-limit.rb
154
183
  * /bin/check-ses-statistics.rb
155
184
  * /bin/check-sqs-messages.rb
@@ -162,12 +191,16 @@
162
191
  * /bin/handler-sns.rb
163
192
  * /bin/metrics-autoscaling-instance-count.rb
164
193
  * /bin/check-instances-count.rb
194
+ * /bin/metrics-asg.rb
195
+ * /bin/metrics-billing.rb
165
196
  * /bin/metrics-ec2-count.rb
166
197
  * /bin/metrics-ec2-filter.rb
167
198
  * /bin/metrics-elasticache.rb
168
199
  * /bin/metrics-elb-full.rb
169
200
  * /bin/metrics-elb.rb
170
201
  * /bin/metrics-emr-steps.rb
202
+ * /bin/metrics-rds.rb
203
+ * /bin/metrics-s3.rb
171
204
  * /bin/metrics-ses.rb
172
205
  * /bin/metrics-sqs.rb
173
206
 
@@ -0,0 +1,127 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-asg-instance-created
4
+ #
5
+ # DESCRIPTION:
6
+ # Check AutoScalingGroup Instances are Terminated & Launching last hour.
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
+ # all AutoScalingGroup
20
+ # ./check-asg-instance-created -r ${your_region}
21
+ # one AutoScalingGroup
22
+ # ./check-asg-instance-created -r ${your_region} -g 'AutoScalingGroupName'
23
+ #
24
+ # NOTES:
25
+ # Based heavily on Peter Hoppe check-asg-instance-created
26
+ #
27
+ # LICENSE:
28
+ # Peter Hoppe <peter.hoppe.extern@bertelsmann.de>
29
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
30
+ # for details.
31
+ #
32
+
33
+ require 'sensu-plugin/check/cli'
34
+ require 'aws-sdk'
35
+ require 'sensu-plugins-aws'
36
+
37
+ class CheckAsgInstanceCreated < Sensu::Plugin::Check::CLI
38
+ include Common
39
+ option :aws_region,
40
+ short: '-r AWS_REGION',
41
+ long: '--aws-region REGION',
42
+ description: 'AWS Region (defaults to us-east-1).',
43
+ default: ENV['AWS_REGION']
44
+
45
+ option :asg_group_name,
46
+ short: '-g G',
47
+ long: '--asg_group_name AutoScalingGroupName',
48
+ description: 'AutoScalingGroupName to check'
49
+
50
+ option :warning_limit,
51
+ short: '-w W',
52
+ long: '--warning_limit Warning Limit',
53
+ description: 'Warning Limit for launching and terminated instances'
54
+
55
+ option :critical_limit,
56
+ short: '-c C',
57
+ long: '--critical_limit Critical Limit',
58
+ description: 'Critical Limit for launching and terminated instances'
59
+
60
+ def asg
61
+ @asg = Aws::AutoScaling::Client.new
62
+ end
63
+
64
+ def describe_activities(asg_group_name)
65
+ asg.describe_scaling_activities(
66
+ auto_scaling_group_name: asg_group_name.to_s
67
+ )
68
+ end
69
+
70
+ def run
71
+ warning = 3
72
+ critical = 4
73
+ result_launched = ''
74
+ result_terminated = ''
75
+ instance_launching = 0
76
+ instance_terminating = 0
77
+ time_now = Time.now
78
+ time_utc_offset = time_now - time_now.utc_offset
79
+
80
+ if !config[:warning_limit].nil?
81
+ warning = config[:warning_limit]
82
+ elsif !config[:critical_limit].nil?
83
+ critical = config[:critical_limit]
84
+ end
85
+
86
+ if config[:asg_group_name].nil?
87
+ asg.describe_auto_scaling_groups.auto_scaling_groups.each do |asg_group|
88
+ describe_activities(asg_group.auto_scaling_group_name).each do |activities|
89
+ activities.activities.each do |activity|
90
+ if Time.parse(activity.start_time.inspect) > (time_utc_offset - 3600)
91
+ if activity.description.include? 'Launching'
92
+ instance_launching += 1
93
+ result_launched = " #{instance_launching} Instances Launching in AutoScalingGroup #{asg_group.auto_scaling_group_name}"
94
+ elsif activity.description.include? 'Terminating'
95
+ instance_terminating += 1
96
+ result_terminated = " #{instance_terminating} Instances Terminated in AutoScalingGroup #{asg_group.auto_scaling_group_name}"
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ else
103
+ describe_activities(config[:asg_group_name]).each do |activities|
104
+ activities.activities.each do |activity|
105
+ if Time.parse(activity.start_time.inspect) > (time_utc_offset - 3600)
106
+ if activity.description.include? 'Launching'
107
+ instance_launching += 1
108
+ result_launched = " #{instance_launching} Instances Launching in AutoScalingGroup #{config[:asg_group_name]}"
109
+ elsif activity.description.include? 'Terminating'
110
+ instance_terminating += 1
111
+ result_terminated = " #{instance_terminating} Instances Terminated in AutoScalingGroup #{config[:asg_group_name]}"
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+ if instance_terminating == 0 && instance_launching == 0
118
+ ok 'No instances Launched & Terminated last hour'
119
+ elsif instance_terminating >= critical && instance_launching >= critical
120
+ critical "#{result_launched} \n #{result_terminated}"
121
+ elsif instance_terminating >= warning && instance_launching >= warning
122
+ warning "#{result_launched} \n #{result_terminated}"
123
+ else
124
+ ok "#{result_launched} \n #{result_terminated}"
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,109 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-autoscaling-instances-inservice
4
+ #
5
+ # DESCRIPTION:
6
+ # Check AutoScaling Instances inService.
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-autoscaling-instances-inservices.rb -r ${your_region}
20
+ # one autoScalingGroup
21
+ # ./check-autoscaling-instances-inservices.rb -r ${your_region} -g 'autoScalingGroupName'
22
+ #
23
+ # NOTES:
24
+ # Based heavily on Yohei Kawahara's check-ec2-network
25
+ #
26
+ # LICENSE:
27
+ # Peter Hoppe <peter.hoppe.extern@bertelsmann.de>
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+
32
+ require 'sensu-plugins-aws'
33
+ require 'sensu-plugin/check/cli'
34
+ require 'aws-sdk'
35
+
36
+ class CheckAsgInstancesInService < Sensu::Plugin::Check::CLI
37
+ include Common
38
+ option :aws_region,
39
+ short: '-r AWS_REGION',
40
+ long: '--aws-region REGION',
41
+ description: 'AWS Region (defaults to us-east-1).',
42
+ default: ENV['AWS_REGION']
43
+
44
+ option :group,
45
+ short: '-g G',
46
+ long: '--autoscaling-group GROUP',
47
+ description: 'AutoScaling group to check'
48
+
49
+ def asg
50
+ @asg ||= Aws::AutoScaling::Client.new
51
+ end
52
+
53
+ def describe_asg(asg_name)
54
+ asg.describe_auto_scaling_groups(
55
+ auto_scaling_group_names: [asg_name.to_s]
56
+ )
57
+ end
58
+
59
+ def run
60
+ warning = 0
61
+ critical = 0
62
+ instance_in_service = 0
63
+ result = ''
64
+ if config[:group].nil?
65
+ asg.describe_auto_scaling_groups.auto_scaling_groups.each do |group|
66
+ grp_name = group.auto_scaling_group_name
67
+ instance_in_service = 0
68
+ group.instances.each do |instance|
69
+ if instance.lifecycle_state == 'InService'
70
+ instance_in_service += 1
71
+ end
72
+ end
73
+ if instance_in_service == 0
74
+ critical = 1
75
+ result += "#{grp_name}: no Instances inService #{instance_in_service} \n"
76
+ elsif instance_in_service < group.min_size
77
+ warning = 1
78
+ result += "#{grp_name} Intance are not okay #{instance_in_service} \n"
79
+ else
80
+ result += "#{grp_name} Intance are inService #{instance_in_service} \n"
81
+ end
82
+ end
83
+ else
84
+ selected_group = describe_asg(config[:group])[0][0]
85
+ min_size = selected_group.min_size
86
+ selected_group.instances.each do |instance|
87
+ if instance.lifecycle_state == 'InService'
88
+ instance_in_service += 1
89
+ end
90
+ end
91
+ if instance_in_service == 0
92
+ critical = 1
93
+ result += "#{config[:group]}: no Instances inService #{instance_in_service} \n"
94
+ elsif instance_in_service < min_size
95
+ warning = 1
96
+ result += "#{config[:group]} Intance are not okay #{instance_in_service} \n"
97
+ else
98
+ result += "#{config[:group]} Intance are inService #{instance_in_service} \n"
99
+ end
100
+ end
101
+ if critical == 1
102
+ critical result
103
+ elsif warning == 1
104
+ warning result
105
+ else
106
+ ok result
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,70 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-cloudfront-tag
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks if cloud front distributions have a set of tags.
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-cloudfront-tag.rb --aws-region eu-west-1 --tag-keys xxx
20
+ #
21
+ # NOTES:
22
+ #
23
+ # LICENSE:
24
+ # Copyright (c) 2016, Olivier Bazoud, olivier.bazoud@gmail.com
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+ #
28
+
29
+ require 'sensu-plugin/check/cli'
30
+ require 'sensu-plugins-aws/common'
31
+ require 'aws-sdk'
32
+
33
+ class CheckCloudFrontTag < Sensu::Plugin::Check::CLI
34
+ include Common
35
+
36
+ option :aws_region,
37
+ short: '-r AWS_REGION',
38
+ long: '--aws-region REGION',
39
+ description: 'AWS Region (defaults to us-east-1).',
40
+ default: 'us-east-1'
41
+
42
+ option :tag_keys,
43
+ short: '-t TAG_KEYS',
44
+ long: '--tag-keys TAG_KEYS',
45
+ description: 'Tag keys'
46
+
47
+ def run
48
+ tags = config[:tag_keys].split(',')
49
+ cloudfront = Aws::CloudFront::Client.new
50
+ missing_tags = []
51
+ cloudfront.list_distributions.distribution_list.items.each do |distribution|
52
+ begin
53
+ keys = cloudfront.list_tags_for_resource(resource: distribution.arn).tags.items.map(&:key)
54
+ if keys.sort & tags.sort != tags.sort
55
+ missing_tags.push distribution.id
56
+ end
57
+ rescue => _
58
+ missing_tags.push distribution.id
59
+ end
60
+ end
61
+
62
+ if missing_tags.empty?
63
+ ok
64
+ else
65
+ critical("Missing tags in #{missing_tags}")
66
+ end
67
+ rescue => e
68
+ critical "Error: #{e.message} - #{e.backtrace}"
69
+ end
70
+ end