sensu-plugins-aws 8.2.0 → 8.3.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: 1b0931032c4f8da410ca8c93791c46ed5ed1a405
4
- data.tar.gz: 9b2f815e235e497dabce48338471af181ff6fec4
3
+ metadata.gz: 8685159465ac57fb22fba51ba9028b291f109286
4
+ data.tar.gz: 68bf94f2885d00593513c1add14815882ca13af8
5
5
  SHA512:
6
- metadata.gz: f7ae3f4a0d297431cf67009c1f4234212ae790d89d947476c1f0a9ac12fb3784074dafcb71b0d17c1fbe1e3525603930167af6f1adb6edbbee9df9caeef4e89c
7
- data.tar.gz: 262bc5237133233f35c402a3f1cdf147634b9d44961caf537e60bd49874e1ad5cdd0de23b0be9b0bcdefc0a532b0b2209e236339f377fca99f8c103cef79587f
6
+ metadata.gz: 9db0befbb10fd44f56e4b5319c93106c11cffbbae69a8309bae5cad2c5af8b693be5b613fe518cdfa163bef82e20d5e1751db1c271e2b795818365d3df0c2fd0
7
+ data.tar.gz: 550d5684866df994929f803729699d9684366bcd2a037d2444f915c9942772ac5013497f19926b278cbf483dba71b0a3fc0e05383696a6f2c42dec373fb2dcae
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [8.3.0] - 2017-09-16
9
+ ### Added
10
+ - check-ec2-cpu_balance.rb: Add option `--tag`/`-t` to add a specified instace tag (e.g. instace name) to message. (@snadorp)
11
+
8
12
  ## [8.2.0] - 2017-09-05
9
13
  ### Added
10
14
  - metrics-rds.rb: adding option `--scheme` to allow changing the default scheme (@julio-ogury)
@@ -363,7 +367,8 @@ WARNING: This release contains major breaking changes that will impact all user
363
367
  ### Added
364
368
  - initial release
365
369
 
366
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.2.0...HEAD
370
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.3.0...HEAD
371
+ [8.3.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.2.0...8.3.0
367
372
  [8.2.0]:https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.1.0...8.2.0
368
373
  [8.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.0.0...8.1.0
369
374
  [8.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.1.0...8.0.0
@@ -17,6 +17,8 @@
17
17
  #
18
18
  # USAGE:
19
19
  # ./check-ec2-cpu_balance -c 20
20
+ # ./check-ec2-cpu_balance -w 25 -c 20
21
+ # ./check-ec2-cpu_balance -c 20 -t 'Name'
20
22
  #
21
23
  # NOTES:
22
24
  #
@@ -52,6 +54,11 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
52
54
  description: 'AWS region',
53
55
  default: 'us-east-1'
54
56
 
57
+ option :tag,
58
+ description: 'Add instance TAG value to warn/critical message.',
59
+ short: '-t TAG',
60
+ long: '--tag TAG'
61
+
55
62
  def data(instance)
56
63
  client = Aws::CloudWatch::Client.new
57
64
  stats = 'Average'
@@ -59,10 +66,12 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
59
66
  resp = client.get_metric_statistics(
60
67
  namespace: 'AWS/EC2',
61
68
  metric_name: 'CPUCreditBalance',
62
- dimensions: [{
63
- name: 'InstanceId',
64
- value: instance
65
- }],
69
+ dimensions: [
70
+ {
71
+ name: 'InstanceId',
72
+ value: instance
73
+ }
74
+ ],
66
75
  start_time: Time.now - period * 10,
67
76
  end_time: Time.now,
68
77
  period: period,
@@ -72,6 +81,11 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
72
81
  return resp.datapoints.first.send(stats.downcase) unless resp.datapoints.first.nil?
73
82
  end
74
83
 
84
+ def instance_tag(instance, tag_name)
85
+ tag = instance.tags.select { |t| t.key == tag_name }.first
86
+ tag.nil? ? '' : tag.value
87
+ end
88
+
75
89
  def run
76
90
  ec2 = Aws::EC2::Client.new
77
91
  instances = ec2.describe_instances(
@@ -90,13 +104,14 @@ class EC2CpuBalance < Sensu::Plugin::Check::CLI
90
104
  next unless instance.instance_type.start_with? 't2.'
91
105
  id = instance.instance_id
92
106
  result = data id
107
+ tag = config[:tag] ? " (#{instance_tag(instance, config[:tag])})" : ''
93
108
  unless result.nil?
94
109
  if result < config[:critical]
95
110
  level = 2
96
- messages << "#{id} is below critical threshold [#{result} < #{config[:critical]}]\n"
111
+ messages << "#{id}#{tag} is below critical threshold [#{result} < #{config[:critical]}]\n"
97
112
  elsif config[:warning] && result < config[:warning]
98
113
  level = 1 if level == 0
99
- messages << "#{id} is below warning threshold [#{result} < #{config[:warning]}]\n"
114
+ messages << "#{id}#{tag} is below warning threshold [#{result} < #{config[:warning]}]\n"
100
115
  end
101
116
  end
102
117
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 8
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  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: 8.2.0
4
+ version: 8.3.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-09-06 00:00:00.000000000 Z
11
+ date: 2017-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -256,82 +256,82 @@ description: |-
256
256
  for EC2, SES, and SNS.
257
257
  email: "<sensu-users@googlegroups.com>"
258
258
  executables:
259
- - check-elb-latency.rb
260
- - check-rds-pending.rb
261
- - metrics-rds.rb
259
+ - check-alb-target-group-health.rb
260
+ - check-asg-instances-created.rb
261
+ - check-asg-instances-inservice.rb
262
+ - check-autoscaling-cpucredits.rb
263
+ - check-beanstalk-elb-metric.rb
264
+ - check-beanstalk-health.rb
265
+ - check-certificate-expiry.rb
266
+ - check-cloudfront-tag.rb
267
+ - check-cloudwatch-alarm.rb
268
+ - check-cloudwatch-alarms.rb
269
+ - check-cloudwatch-composite-metric.rb
262
270
  - check-cloudwatch-metric.rb
263
271
  - check-configservice-rules.rb
264
- - check-elb-certs.rb
265
- - metrics-elb-full.rb
266
- - check-ses-statistics.rb
267
- - check-reserved-instances.rb
268
- - check-cloudwatch-alarms.rb
269
- - check-emr-steps.rb
270
- - check-elb-instances-inservice.rb
272
+ - check-dynamodb-capacity.rb
271
273
  - check-dynamodb-throttle.rb
272
- - check-s3-object.rb
273
- - handler-scale-asg-up.rb
274
+ - check-ebs-burst-limit.rb
275
+ - check-ebs-snapshots.rb
276
+ - check-ec2-cpu_balance.rb
277
+ - check-ec2-filter.rb
278
+ - check-ec2-network.rb
279
+ - check-ecs-service-health.rb
280
+ - check-eip-allocation.rb
281
+ - check-elasticache-failover.rb
282
+ - check-elb-certs.rb
283
+ - check-elb-health-fog.rb
274
284
  - check-elb-health-sdk.rb
275
- - metrics-sqs.rb
276
- - check-vpc-nameservers.rb
277
- - check-eni-status.rb
278
- - check-s3-tag.rb
279
- - check-rds.rb
280
- - check-cloudwatch-composite-metric.rb
285
+ - check-elb-health.rb
286
+ - check-elb-instances-inservice.rb
287
+ - check-elb-latency.rb
288
+ - check-elb-nodes.rb
281
289
  - check-elb-sum-requests.rb
282
- - metrics-asg.rb
283
- - check-instances-count.rb
290
+ - check-emr-cluster.rb
291
+ - check-emr-steps.rb
292
+ - check-eni-status.rb
293
+ - check-instance-events.rb
284
294
  - check-instance-health.rb
285
- - metrics-ec2-filter.rb
286
- - check-route53-domain-expiration.rb
287
- - check-elb-health.rb
288
- - check-beanstalk-elb-metric.rb
289
- - check-eip-allocation.rb
295
+ - check-instance-reachability.rb
296
+ - check-instances-count.rb
290
297
  - check-kms-key.rb
291
- - check-dynamodb-capacity.rb
292
- - check-elasticache-failover.rb
293
- - handler-ses.rb
294
- - check-subnet-ip-consumption.rb
295
- - check-trustedadvisor-service-limits.rb
296
- - check-ebs-burst-limit.rb
297
- - check-asg-instances-inservice.rb
298
- - check-alb-target-group-health.rb
299
- - check-autoscaling-cpucredits.rb
300
- - check-ses-limit.rb
301
- - check-asg-instances-created.rb
302
- - check-certificate-expiry.rb
303
- - check-sns-subscriptions.rb
304
- - check-ec2-filter.rb
305
- - metrics-s3.rb
306
- - metrics-ses.rb
307
- - check-ebs-snapshots.rb
308
298
  - check-rds-events.rb
309
- - check-ec2-network.rb
310
- - metrics-ec2-count.rb
311
- - metrics-autoscaling-instance-count.rb
312
- - metrics-billing.rb
313
- - check-cloudfront-tag.rb
314
- - check-instance-reachability.rb
315
- - check-emr-cluster.rb
299
+ - check-rds-pending.rb
300
+ - check-rds.rb
301
+ - check-redshift-events.rb
302
+ - check-reserved-instances.rb
303
+ - check-route.rb
304
+ - check-route53-domain-expiration.rb
305
+ - check-s3-bucket.rb
306
+ - check-s3-object.rb
307
+ - check-s3-tag.rb
316
308
  - check-sensu-client.rb
309
+ - check-ses-limit.rb
310
+ - check-ses-statistics.rb
311
+ - check-sns-subscriptions.rb
317
312
  - check-sqs-messages.rb
313
+ - check-subnet-ip-consumption.rb
314
+ - check-trustedadvisor-service-limits.rb
315
+ - check-vpc-nameservers.rb
318
316
  - check-vpc-vpn.rb
319
- - metrics-elb.rb
320
- - check-elb-health-fog.rb
321
- - check-s3-bucket.rb
322
- - check-route.rb
323
317
  - handler-ec2_node.rb
324
- - check-instance-events.rb
325
- - check-elb-nodes.rb
326
- - check-ec2-cpu_balance.rb
327
- - metrics-emr-steps.rb
328
- - check-ecs-service-health.rb
329
- - check-redshift-events.rb
330
- - check-beanstalk-health.rb
331
318
  - handler-scale-asg-down.rb
319
+ - handler-scale-asg-up.rb
320
+ - handler-ses.rb
332
321
  - handler-sns.rb
322
+ - metrics-asg.rb
323
+ - metrics-autoscaling-instance-count.rb
324
+ - metrics-billing.rb
325
+ - metrics-ec2-count.rb
326
+ - metrics-ec2-filter.rb
333
327
  - metrics-elasticache.rb
334
- - check-cloudwatch-alarm.rb
328
+ - metrics-elb-full.rb
329
+ - metrics-elb.rb
330
+ - metrics-emr-steps.rb
331
+ - metrics-rds.rb
332
+ - metrics-s3.rb
333
+ - metrics-ses.rb
334
+ - metrics-sqs.rb
335
335
  extensions: []
336
336
  extra_rdoc_files: []
337
337
  files:
@@ -445,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
445
  version: '0'
446
446
  requirements: []
447
447
  rubyforge_project:
448
- rubygems_version: 2.4.5.1
448
+ rubygems_version: 2.6.13
449
449
  signing_key:
450
450
  specification_version: 4
451
451
  summary: Sensu plugins for working with an AWS environment