sensu 0.20.3 → 0.20.4

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: b4b99ec27fad9dd917c0a15b4aee2effdd105cce
4
- data.tar.gz: 6599a21f33b14289af3b2d4bc7ecbf983853f16c
3
+ metadata.gz: 5469b19ac21f6339e4d64ae5c8437e58f2f19b50
4
+ data.tar.gz: ea3e79ea6588dfd3579b0dca1b39282b988cceaa
5
5
  SHA512:
6
- metadata.gz: 495461ab13fbeb0c93e838e66f357cb7a109fabd7467ec8fff47a78c565a1964563af35b580058a2f79bbaf0bff6c193939532744119c16a39fc83a72fc24620
7
- data.tar.gz: 2d9b0a49eb9c887b9061020cf10ec42fe2c73e9e70d936def991a0f30243c8526536a8e4d069dafeaef7e31e0a3e304b3f283044a0fa892fb1bb1edc1c677882
6
+ metadata.gz: 0c0d2fcb925f79554e5c5a7e39852ad2db7c0db1fef889c4c9be68432a742c747a96266d77c99915aa9ee65b9cdf99a744feedcd4c5830750fe94222ec3d2f49
7
+ data.tar.gz: ab20c73aaca110365baafde283548bca34a7863ae65dd523ffc98bc3d1945f8abbd30aca06e452d5700d56e5ef110025b9642d72268a62e4c0011cd8c520ff30
@@ -1,3 +1,17 @@
1
+ ## 0.20.4 - 2015-08-28
2
+
3
+ ### Other
4
+
5
+ Improved check output truncation. Metric check output is truncated to a
6
+ single line and 256 characters. Standard check output is not modified.
7
+
8
+ Fixed API /results endpoint, now including all results in a single
9
+ response (unless pagination is used).
10
+
11
+ Locked amq-protocol to 1.9.2, as 2.x.x does not work on older Rubies.
12
+
13
+ Fixed pipe handler output logging on JRuby.
14
+
1
15
  ## 0.20.3 - 2015-08-11
2
16
 
3
17
  ### Other
@@ -740,7 +740,7 @@ module Sensu
740
740
  unless clients.empty?
741
741
  clients.each_with_index do |client_name, client_index|
742
742
  settings.redis.smembers("result:#{client_name}") do |checks|
743
- unless checks.empty?
743
+ if !checks.empty?
744
744
  checks.each_with_index do |check_name, check_index|
745
745
  result_key = "result:#{client_name}:#{check_name}"
746
746
  settings.redis.get(result_key) do |result_json|
@@ -751,7 +751,7 @@ module Sensu
751
751
  end
752
752
  end
753
753
  end
754
- else
754
+ elsif client_index == clients.size - 1
755
755
  body MultiJson.dump(response)
756
756
  end
757
757
  end
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "0.20.3"
4
+ VERSION = "0.20.4"
5
5
 
6
6
  # Sensu check severities.
7
7
  SEVERITIES = %w[ok warning critical unknown]
@@ -7,7 +7,7 @@ gem "sensu-logger", "1.0.0"
7
7
  gem "sensu-settings", "3.1.0"
8
8
  gem "sensu-extension", "1.1.2"
9
9
  gem "sensu-extensions", "1.2.0"
10
- gem "sensu-transport", "3.2.0"
10
+ gem "sensu-transport", "3.2.1"
11
11
  gem "sensu-spawn", "1.3.0"
12
12
 
13
13
  require "time"
@@ -34,7 +34,7 @@ module Sensu
34
34
  Spawn.process(handler[:command], options) do |output, status|
35
35
  @logger.info("handler output", {
36
36
  :handler => handler,
37
- :output => output.lines
37
+ :output => output.split("\n+")
38
38
  })
39
39
  @handling_event_count -= 1 if @handling_event_count
40
40
  end
@@ -199,11 +199,33 @@ module Sensu
199
199
  end
200
200
  end
201
201
 
202
+ # Truncate check output. For metric checks, (`"type":
203
+ # "metric"`), check output is truncated to a single line and a
204
+ # maximum of 255 characters. Check output is currently left
205
+ # unmodified for standard checks.
206
+ #
207
+ # @param check [Hash]
208
+ # @return [Hash] check with truncated output.
209
+ def truncate_check_output(check)
210
+ case check[:type]
211
+ when "metric"
212
+ output_lines = check[:output].split("\n")
213
+ output = output_lines.first
214
+ if output_lines.size > 1 || output.length > 255
215
+ output = output[0..255] + "\n..."
216
+ end
217
+ check.merge(:output => output)
218
+ else
219
+ check
220
+ end
221
+ end
222
+
202
223
  # Store check result data. This method stores check result data
203
224
  # and the 21 most recent check result statuses for a client/check
204
225
  # pair, this history is used for event context and flap detection.
205
226
  # The check execution timestamp is also stored, to provide an
206
- # indication of how recent the data is.
227
+ # indication of how recent the data is. Check output is
228
+ # truncated by `truncate_check_output()` before it is stored.
207
229
  #
208
230
  # @param client [Hash]
209
231
  # @param check [Hash]
@@ -213,7 +235,7 @@ module Sensu
213
235
  @logger.debug("storing check result", :check => check)
214
236
  @redis.sadd("result:#{client[:name]}", check[:name])
215
237
  result_key = "#{client[:name]}:#{check[:name]}"
216
- check_truncated = check.merge(:output => check[:output][0..256])
238
+ check_truncated = truncate_check_output(check)
217
239
  @redis.set("result:#{result_key}", MultiJson.dump(check_truncated)) do
218
240
  history_key = "history:#{result_key}"
219
241
  @redis.rpush(history_key, check[:status]) do
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency "sensu-settings", "3.1.0"
23
23
  s.add_dependency "sensu-extension", "1.1.2"
24
24
  s.add_dependency "sensu-extensions", "1.2.0"
25
- s.add_dependency "sensu-transport", "3.2.0"
25
+ s.add_dependency "sensu-transport", "3.2.1"
26
26
  s.add_dependency "sensu-spawn", "1.3.0"
27
27
  s.add_dependency "em-redis-unified", "1.0.0"
28
28
  s.add_dependency "sinatra", "1.4.6"
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: 0.20.3
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-11 00:00:00.000000000 Z
12
+ date: 2015-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: 3.2.0
132
+ version: 3.2.1
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: 3.2.0
139
+ version: 3.2.1
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: sensu-spawn
142
142
  requirement: !ruby/object:Gem::Requirement