sensu-plugins-aws 12.2.0 → 12.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
  SHA256:
3
- metadata.gz: ce55a0c21af3905f22f4c36f0c47886c571e4f03c75cded90e38337c281f1a57
4
- data.tar.gz: 4d3a0a6038e3437ae00730141aac0960f8d2771ea1ff387844f1db3224c1a536
3
+ metadata.gz: fa40ff444029fc7cb2c4ef89966981387a20b400a7ee63cd0c38ea4f468408cd
4
+ data.tar.gz: 815790362658942c50a6eddbc863a7df44dfccf4a6093b15d2cd44f5e4837070
5
5
  SHA512:
6
- metadata.gz: 7f74d5fc377602de4098a55fb91215e41aa0729c95499d70a19154c00c8c313bdc467a9f5435b42092114745f132bb081e04c9e2a7abfe8794d92e0bdc5847f7
7
- data.tar.gz: 8e0216498809a7b8b3fb9ea55ddeaa356a9c964253700c0dc223994053c26d877cc8e5bb5d12ea97e20b522aa6755d8e18790702caf830633df7ab50a7ee4f64
6
+ metadata.gz: 1635d01eb4c6680353866036a759c768ef5b1c522b9cbd569977dbd93fb4bf86a7d8b0fc6e8df987759e77152964d86477403cba7fe12edc6e9882b5ff386665
7
+ data.tar.gz: f08e385b563e850d31ec4ae70d0743810a3d7c5d8cf7e965e09306424048f2646b914589103d6dcf71e9ffd405e7503e6ba552aecee5da4c8af6922ec90771f4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [12.3.0] - 2018-09-25
9
+ ### Added
10
+ - check-s3-objects.rb: Allow check to run against the newest of multiple matching objects (@akatch)
11
+
8
12
  ## [12.2.0] - 2018-09-14
9
13
  ### Added
10
14
  - Add `check-direct-connect-virtual-interfaces.rb` to check the status of Direct Connect virtual interfaces
@@ -498,7 +502,8 @@ WARNING: This release contains major breaking changes that will impact all user
498
502
  ### Added
499
503
  - initial release
500
504
 
501
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.2.0...HEAD
505
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.3.0...HEAD
506
+ [12.3.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.2.0...12.3.0
502
507
  [12.2.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.1.0...12.2.0
503
508
  [12.1.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/12.0.0...12.1.0
504
509
  [12.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/11.6.0...12.0.0
@@ -102,6 +102,12 @@ class CheckS3Object < Sensu::Plugin::Check::CLI
102
102
  long: '--operator-size OPERATION',
103
103
  default: 'equal'
104
104
 
105
+ option :no_crit_on_multiple_objects,
106
+ description: 'If this flag is set, sort all matching objects by last_modified date and check against the newest. By default, this check will return a CRITICAL result if multiple matching objects are found.',
107
+ short: '-m',
108
+ long: '--ok-on-multiple-objects',
109
+ boolean: true
110
+
105
111
  def aws_config
106
112
  { access_key_id: config[:aws_access_key],
107
113
  secret_access_key: config[:aws_secret_access_key],
@@ -158,13 +164,18 @@ class CheckS3Object < Sensu::Plugin::Check::CLI
158
164
  elsif !config[:key_prefix].nil?
159
165
  key_search = config[:key_prefix]
160
166
  output = s3.list_objects(bucket: config[:bucket_name], prefix: key_search)
167
+ output = output.next_page while output.next_page?
161
168
 
162
169
  if output.contents.size.to_i < 1
163
170
  critical "Object with prefix \"#{key_search}\" not found in bucket #{config[:bucket_name]}"
164
171
  end
165
172
 
166
173
  if output.contents.size.to_i > 1
167
- critical "Your prefix \"#{key_search}\" return too much files, you need to be more specific"
174
+ if config[:no_crit_on_multiple_objects].nil?
175
+ critical "Your prefix \"#{key_search}\" return too much files, you need to be more specific"
176
+ else
177
+ output.contents.sort_by!(&:last_modified).reverse!
178
+ end
168
179
  end
169
180
 
170
181
  key_fullname = output.contents[0].key
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsAWS
2
2
  module Version
3
3
  MAJOR = 12
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: 12.2.0
4
+ version: 12.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: 2018-09-15 00:00:00.000000000 Z
11
+ date: 2018-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin