sensu 0.12.3 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.12.4 - 2014-01-17
2
+
3
+ ### Other
4
+
5
+ Fixed filter "eval:" on Ruby 2.1.0, and logging errors.
6
+
7
+ Fixed handler severity filtering when event action is "resolve". Events
8
+ with an action of "resolve" will be negated if the severity conditions have
9
+ not been met since the last OK status.
10
+
11
+ ## 0.12.3 - 2013-12-19
12
+
13
+ ### Other
14
+
15
+ The pipe handler and mutator concurrency limit is now imposed by
16
+ `EM::Worker`. A maximum of 12 processes may be spawned at a time.
17
+
1
18
  ## 0.12.2 - 2013-11-22
2
19
 
3
20
  ### Other
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.12.3'
3
+ VERSION = '0.12.4'
4
4
 
5
5
  LOG_LEVELS = [:debug, :info, :warn, :error, :fatal]
6
6
 
data/lib/sensu/sandbox.rb CHANGED
@@ -2,7 +2,7 @@ module Sensu
2
2
  module Sandbox
3
3
  def self.eval(expression, value=nil)
4
4
  result = Proc.new do
5
- $SAFE = 4
5
+ $SAFE = (RUBY_VERSION < '2.1.0' ? 4 : 3)
6
6
  Kernel.eval(expression)
7
7
  end
8
8
  result.call
data/lib/sensu/server.rb CHANGED
@@ -148,7 +148,11 @@ module Sensu
148
148
  begin
149
149
  expression = hash_one[key].gsub(/^eval:(\s+)?/, '')
150
150
  !!Sandbox.eval(expression, hash_two[key])
151
- rescue
151
+ rescue => error
152
+ @logger.error('filter eval error', {
153
+ :attributes => [hash_one, hash_two],
154
+ :error => error.to_s
155
+ })
152
156
  false
153
157
  end
154
158
  else
@@ -193,7 +197,6 @@ module Sensu
193
197
  def event_handlers(event)
194
198
  handler_list = Array((event[:check][:handlers] || event[:check][:handler]) || 'default')
195
199
  handlers = derive_handlers(handler_list)
196
- event_severity = SEVERITIES[event[:check][:status]] || 'unknown'
197
200
  handlers.select do |handler|
198
201
  if event[:action] == :flapping && !handler[:handle_flapping]
199
202
  @logger.info('handler does not handle flapping events', {
@@ -209,8 +212,21 @@ module Sensu
209
212
  })
210
213
  next
211
214
  end
212
- if handler.has_key?(:severities) && !handler[:severities].include?(event_severity)
213
- unless event[:action] == :resolve
215
+ if handler.has_key?(:severities)
216
+ handle = case event[:action]
217
+ when :resolve
218
+ event[:check][:history].reverse[1..-1].any? do |status|
219
+ if status == 0
220
+ break
221
+ end
222
+ severity = SEVERITIES[status] || 'unknown'
223
+ handler[:severities].include?(severity)
224
+ end
225
+ else
226
+ severity = SEVERITIES[event[:check][:status]] || 'unknown'
227
+ handler[:severities].include?(severity)
228
+ end
229
+ unless handle
214
230
  @logger.debug('handler does not handle event severity', {
215
231
  :event => event,
216
232
  :handler => handler
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 39
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 12
9
- - 3
10
- version: 0.12.3
9
+ - 4
10
+ version: 0.12.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Porter
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-12-19 00:00:00 -08:00
19
+ date: 2014-01-17 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency