sensu-plugins-aws 8.0.0 → 8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d910f32661d096968c169850cc1e4152e26ba551
4
- data.tar.gz: ab4e699cff566384ea3d23f3b63c6bfca3d4f2e0
3
+ metadata.gz: bd94bf1248d6d67b165ad6fb646a250505740e1b
4
+ data.tar.gz: 4fb80e7ec4923a4cfdb1ee38e497bbc19a7c9227
5
5
  SHA512:
6
- metadata.gz: 31476cd9c8ea48ec1ffbf4ba175939368efdc3bd580a9dcc3c52929e9e48fee66d233a02de0d66cbeb6f323f694b068de01a710945fabe006ddb82f249c5c754
7
- data.tar.gz: e354d8bfd167f4a75b397073afda995a2f416233bd7b7f36b5e0323e063b148137a9273affdef026f5d11060d02b429d27c98a0177cf009acdf99f9e92ff2dd0
6
+ metadata.gz: 937d38cc131474c8bdcb8e30153235d1a06d2904a94f9fcb9a131081af62a38d49c0680aa486fc0f555b6976f9c6d2aa4a9105df7c1df7f8a4a16d1e26f2ed9c
7
+ data.tar.gz: 86b253049fd2e5e7fc1ddd1f76b8be25a35398436f9e6c377adce7ff4abdcf9887fde9f562d02734fcef21388a3302cedda140bde416d9b056307c4407dd7760
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [8.1.0] - 2017-08-28
9
+ ### Fixed
10
+ check-ebs-burst-limit.rb: Only compare the warning threshold if a `-w` option was specified on the command-line, as usage shows `-w` is optional. (@ivanfetch)
11
+
12
+ ### Added
13
+ - check-ebs-burst-limit.rb: Only check volumes attached to the current instance with a new `-s` option, which also overrides the `-r` option for EC2 region. (@ivanfetch)
14
+
8
15
  ## [8.0.0] - 2017-08-20
9
16
  ### Breaking Changes
10
17
  - check-beanstalk-elb-metric.rb and check-cloudwatch-metric.rb: `--opertor` flag was a typo, please use `--operator` now. (@guikcd)
@@ -353,6 +360,7 @@ WARNING: This release contains major breaking changes that will impact all user
353
360
  - initial release
354
361
 
355
362
  [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.0.0...HEAD
363
+ [8.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.0.0...8.1.0
356
364
  [8.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.1.0...8.0.0
357
365
  [7.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.0.1...7.1.0
358
366
  [7.0.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/7.0.0...7.0.1
@@ -3,7 +3,8 @@
3
3
  # check-ebs-burst-limit
4
4
  #
5
5
  # DESCRIPTION:
6
- # Check EC2 Attached Volumes for volumes with low burst balance
6
+ # Check EC2 Volumes for volumes with low burst balance
7
+ # Optionally check only volumes attached to the current instance
7
8
  #
8
9
  # OUTPUT:
9
10
  # plain-text
@@ -29,6 +30,7 @@
29
30
  require 'sensu-plugin/check/cli'
30
31
  require 'sensu-plugins-aws'
31
32
  require 'aws-sdk'
33
+ require 'net/http'
32
34
 
33
35
  class CheckEbsBurstLimit < Sensu::Plugin::Check::CLI
34
36
  include CloudwatchCommon
@@ -36,7 +38,7 @@ class CheckEbsBurstLimit < Sensu::Plugin::Check::CLI
36
38
  option :aws_region,
37
39
  short: '-r R',
38
40
  long: '--region REGION',
39
- description: 'AWS region',
41
+ description: 'AWS region, will be overridden by the -s option',
40
42
  default: 'us-east-1'
41
43
 
42
44
  option :critical,
@@ -52,16 +54,41 @@ class CheckEbsBurstLimit < Sensu::Plugin::Check::CLI
52
54
  long: '--warning VALUE',
53
55
  proc: proc(&:to_f)
54
56
 
57
+ option :check_self,
58
+ short: '-s',
59
+ long: '--check-self',
60
+ description: 'Only check the instance on which this plugin is being run - this overrides the -r option and uses the region of the current instance',
61
+ boolean: true,
62
+ default: false
63
+
55
64
  def run
56
65
  errors = []
57
- ec2 = Aws::EC2::Client.new
58
- volumes = ec2.describe_volumes(
59
- filters: [
66
+
67
+ # Set the describe-volumes filter depending on whether -s was specified
68
+ if config[:check_self] == true
69
+ # Get the region from the availability zone, and override the -r option
70
+ my_instance_az = Net::HTTP.get(URI.parse('http://169.254.169.254/latest/meta-data/placement/availability-zone'))
71
+ Aws.config[:region] = my_instance_az.chop
72
+ my_instance_id = Net::HTTP.get(URI.parse('http://169.254.169.254/latest/meta-data/instance-id'))
73
+ volume_filters = [
74
+ {
75
+ name: 'attachment.instance-id',
76
+ values: [my_instance_id]
77
+ }
78
+ ]
79
+ else
80
+ # The -s option was not specified, look at all volumes which are attached
81
+ volume_filters = [
60
82
  {
61
83
  name: 'attachment.status',
62
84
  values: ['attached']
63
85
  }
64
86
  ]
87
+ end
88
+
89
+ ec2 = Aws::EC2::Client.new
90
+ volumes = ec2.describe_volumes(
91
+ filters: volume_filters
65
92
  )
66
93
  config[:metric_name] = 'BurstBalance'
67
94
  config[:namespace] = 'AWS/EBS'
@@ -78,7 +105,7 @@ class CheckEbsBurstLimit < Sensu::Plugin::Check::CLI
78
105
  if resp.datapoints.first[:average] < config[:critical]
79
106
  errors << "#{volume[:volume_id]} #{resp.datapoints.first[:average]}"
80
107
  crit = true
81
- elsif resp.datapoints.first[:average] < config[:warning]
108
+ elsif config[:warning] && resp.datapoints.first[:average] < config[:warning]
82
109
  errors << "#{volume[:volume_id]} #{resp.datapoints.first[:average]}"
83
110
  should_warn = true
84
111
  end
@@ -16,9 +16,7 @@
16
16
  # gem: sensu-plugin
17
17
  #
18
18
  # USAGE:
19
- # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} --warning-over 1000000 --critical-over 1500000
20
- # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} -d NetworkIn --warning-over 1000000 --critical-over 1500000
21
- # ./check-ec2-network.rb -r ${you_region} -i ${your_instance_id} -d NetworkOut --warning-over 1000000 --critical-over 1500000
19
+ # ./check-elb-health.rb --elb-name MyELB
22
20
  #
23
21
  # NOTES:
24
22
  #
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 8
4
- MINOR = 0
4
+ MINOR = 1
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.0.0
4
+ version: 8.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-21 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk