sensu 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 728eb3609156df3d3489872c99c1d4ef04b8a92b
4
- data.tar.gz: ea6d94c2b1f3addfe260054bbf18bfe1e0954e13
3
+ metadata.gz: 50aff68890750e1f00216055fb07a1ce9fc42d1a
4
+ data.tar.gz: 9414ba01d9e17fed244df0c41643113d87c9f9a3
5
5
  SHA512:
6
- metadata.gz: 6a79bb25f822ff870f9188e3e9fd474bfb29fffe03556d1361121d33cfd6f8991718452e3740f5f3272bbcb6dbd7df6eac2dd2043782a52494358970a6d9305c
7
- data.tar.gz: fe0ac2b3af8f6ce01e8b61684cd93bdff4361604be2da8f003c7c5f914ba6edb293bd29ad7b989f0cfb549e6bf696372c6eff85eb7189f5f445dc2c38955ead7
6
+ metadata.gz: b3cd5096f3c1a88b07d3a84a95851abc37a3f6c8949dc517692dd2b7783e66fdeb2aae5b83f2a99d328bfe4fcd6f2073ff837890a0ab78ccdc4bd9078a2d88a0
7
+ data.tar.gz: 6fe20dfb75829f00412dd51f244e5e8955dd7d37475d70a35d6fd49cd4aea77f54156bcf0fc82cd22d3695f1f23034f370a0651278fd20986d2f1a1487582161
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -5,6 +5,17 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.9.0] - 2019-12-18
9
+
10
+ ### Fixed
11
+ - Fixed check subdue times resolution, now including nanoseconds.
12
+ - API 204 no content responses now return a nil body.
13
+ - Fixed Travis CI testing (RabbitMQ was missing on Xenial).
14
+
15
+ ### Added
16
+ - Added support for discarding oversized transport messages to protect
17
+ Sensu, e.g. {"sensu":{"server": {"max_message_size": 2097152}}}.
18
+
8
19
  ## [1.8.0] - 2019-07-09
9
20
 
10
21
  ### Added
data/README.md CHANGED
@@ -5,13 +5,14 @@
5
5
  [![MIT Licensed](https://img.shields.io/github/license/sensu/sensu.svg)](https://raw.githubusercontent.com/sensu/sensu/master/MIT-LICENSE.txt)
6
6
  [![Join the chat at https://slack.sensu.io/](https://slack.sensu.io/badge.svg)](https://slack.sensu.io/)
7
7
 
8
- ** ANNOUNCEMENT - Sensu 1.x End-Of-Life on December 31st, 2019 **
8
+ :warning: **ANNOUNCEMENT - Sensu 1.x End-Of-Life on December 31st, 2019**
9
9
 
10
10
  Sensu 1.x is currently in maintenance mode (critical bugs and security
11
11
  patch releases only) with no new feature enhancements or additions
12
12
  being planned at this time. The project will be end-of-life on
13
- December 31st, 2019. Please see our Discourse post for more details:
14
- https://discourse.sensu.io/t/the-eol-schedule-for-sensu-core-1-x-and-sensu-enterprise-3-x/1222
13
+ December 31st, 2019 and existing package repositories will become
14
+ unreachable on January 6th, 2020. Please see our blog post for more details:
15
+ https://blog.sensu.io/announcing-the-sensu-archives
15
16
 
16
17
  Sensu 1.x has been superseded by [Sensu Go](https://github.com/sensu/sensu-go).
17
18
 
@@ -281,6 +281,7 @@ module Sensu
281
281
  def no_content!
282
282
  @response_status = 204
283
283
  @response_status_string = "No Content"
284
+ @response_content = nil
284
285
  respond
285
286
  end
286
287
 
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "1.8.0".freeze
4
+ VERSION = "1.9.0".freeze
5
5
 
6
6
  # Sensu release information.
7
7
  RELEASE_INFO = {
@@ -4,7 +4,7 @@ gem "eventmachine", "1.2.7"
4
4
 
5
5
  gem "sensu-json", "2.1.1"
6
6
  gem "sensu-logger", "1.2.2"
7
- gem "sensu-settings", "10.16.0"
7
+ gem "sensu-settings", "10.17.0"
8
8
  gem "sensu-extension", "1.5.2"
9
9
  gem "sensu-extensions", "1.11.0"
10
10
  gem "sensu-transport", "8.3.0"
@@ -175,6 +175,33 @@ module Sensu
175
175
  end
176
176
  end
177
177
 
178
+ # Determine if a transport message is under the optional
179
+ # configured max message size. This method helps prevent
180
+ # oversized messages from consuming memory and being persisted
181
+ # to the datastore.
182
+ #
183
+ # @param message [String]
184
+ # @return [TrueClass,FalseClass]
185
+ def message_size_ok?(message)
186
+ if @settings[:sensu][:server] &&
187
+ @settings[:sensu][:server][:max_message_size]
188
+ message_size = message.bytesize
189
+ max_message_size = @settings[:sensu][:server][:max_message_size]
190
+ if message_size <= max_message_size
191
+ true
192
+ else
193
+ @logger.error("message exceeds the configured max message size", {
194
+ :max_message_size => max_message_size,
195
+ :message_size => message_size,
196
+ :message => message
197
+ })
198
+ false
199
+ end
200
+ else
201
+ true
202
+ end
203
+ end
204
+
178
205
  # Set up the client keepalive consumer, keeping the Sensu client
179
206
  # registry updated. The consumer receives JSON serialized client
180
207
  # keepalives from the transport, parses them, and calls
@@ -190,14 +217,16 @@ module Sensu
190
217
  @logger.debug("subscribing to keepalives", :pipe => keepalives_pipe)
191
218
  @transport.subscribe(:direct, keepalives_pipe, "keepalives", :ack => true) do |message_info, message|
192
219
  @logger.debug("received keepalive", :message => message)
193
- begin
194
- client = Sensu::JSON.load(message)
195
- update_client_registry(client)
196
- rescue Sensu::JSON::ParseError => error
197
- @logger.error("failed to parse keepalive payload", {
198
- :message => message,
199
- :error => error.to_s
200
- })
220
+ if message_size_ok?(message)
221
+ begin
222
+ client = Sensu::JSON.load(message)
223
+ update_client_registry(client)
224
+ rescue Sensu::JSON::ParseError => error
225
+ @logger.error("failed to parse keepalive payload", {
226
+ :message => message,
227
+ :error => error.to_s
228
+ })
229
+ end
201
230
  end
202
231
  EM::next_tick do
203
232
  @transport.ack(message_info)
@@ -742,15 +771,17 @@ module Sensu
742
771
  end
743
772
  @logger.debug("subscribing to results", :pipe => results_pipe)
744
773
  @transport.subscribe(:direct, results_pipe, "results", :ack => true) do |message_info, message|
745
- begin
746
- result = Sensu::JSON.load(message)
747
- @logger.debug("received result", :result => result)
748
- process_check_result(result)
749
- rescue Sensu::JSON::ParseError => error
750
- @logger.error("failed to parse result payload", {
751
- :message => message,
752
- :error => error.to_s
753
- })
774
+ if message_size_ok?(message)
775
+ begin
776
+ result = Sensu::JSON.load(message)
777
+ @logger.debug("received result", :result => result)
778
+ process_check_result(result)
779
+ rescue Sensu::JSON::ParseError => error
780
+ @logger.error("failed to parse result payload", {
781
+ :message => message,
782
+ :error => error.to_s
783
+ })
784
+ end
754
785
  end
755
786
  EM::next_tick do
756
787
  @transport.ack(message_info)
@@ -8,6 +8,7 @@ require "socket"
8
8
  module Sensu
9
9
  module Utilities
10
10
  EVAL_PREFIX = "eval:".freeze
11
+ NANOSECOND_RESOLUTION = 9.freeze
11
12
 
12
13
  # Determine if Sensu is being tested, using the process name.
13
14
  # Sensu is being test if the process name is "rspec",
@@ -334,9 +335,9 @@ module Sensu
334
335
  end_time = Time.parse(condition[:end])
335
336
  if end_time < begin_time
336
337
  if Time.now < end_time
337
- begin_time = Time.new(*begin_time.strftime("%Y %m %d 00 00 00 %:z").split("\s"))
338
+ begin_time = Time.parse(*begin_time.strftime("%Y-%m-%d 00:00:00.#{Array.new(NANOSECOND_RESOLUTION, 0).join} %:z"))
338
339
  else
339
- end_time = Time.new(*end_time.strftime("%Y %m %d 23 59 59 %:z").split("\s"))
340
+ end_time = Time.parse(*end_time.strftime("%Y-%m-%d 23:59:59.#{Array.new(NANOSECOND_RESOLUTION, 9).join} %:z"))
340
341
  end
341
342
  end
342
343
  Time.now >= begin_time && Time.now <= end_time
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_dependency "eventmachine", "1.2.7"
15
15
  s.add_dependency "sensu-json", "2.1.1"
16
16
  s.add_dependency "sensu-logger", "1.2.2"
17
- s.add_dependency "sensu-settings", "10.16.0"
17
+ s.add_dependency "sensu-settings", "10.17.0"
18
18
  s.add_dependency "sensu-extension", "1.5.2"
19
19
  s.add_dependency "sensu-extensions", "1.11.0"
20
20
  s.add_dependency "sensu-transport", "8.3.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -30,7 +30,7 @@ cert_chain:
30
30
  X5jpMGFeJITiueL7BQsPY5HHiTjshkT/ltr+YQnQd3g3jR8+AoCIUylCFdJNy2CZ
31
31
  oPVvM0H5TyjtwccVj04b6tZoRho=
32
32
  -----END CERTIFICATE-----
33
- date: 2019-07-09 00:00:00.000000000 Z
33
+ date: 2019-12-19 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: eventmachine
@@ -80,14 +80,14 @@ dependencies:
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 10.16.0
83
+ version: 10.17.0
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 10.16.0
90
+ version: 10.17.0
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: sensu-extension
93
93
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file