sensu 0.9.8.beta.3 → 0.9.8.beta.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sensu/api.rb CHANGED
@@ -199,14 +199,15 @@ module Sensu
199
199
  )
200
200
  end
201
201
 
202
- def resolve_event(client_name, check_name)
202
+ def resolve_event(event)
203
203
  payload = {
204
- :client => client_name,
204
+ :client => event[:client],
205
205
  :check => {
206
- :name => check_name,
206
+ :name => event[:check],
207
207
  :output => 'Resolving on request of the API',
208
208
  :status => 0,
209
209
  :issued => Time.now.to_i,
210
+ :handlers => event[:handlers],
210
211
  :force_resolve => true
211
212
  }
212
213
  }
@@ -268,8 +269,8 @@ module Sensu
268
269
  $redis.get('client:' + client_name).callback do |client_json|
269
270
  unless client_json.nil?
270
271
  $redis.hgetall('events:' + client_name).callback do |events|
271
- events.each_key do |check_name|
272
- resolve_event(client_name, check_name)
272
+ events.each do |check_name, event_json|
273
+ resolve_event(event_hash(event_json, client_name, check_name))
273
274
  end
274
275
  EM::Timer.new(5) do
275
276
  client = JSON.parse(client_json, :symbolize_names => true)
@@ -386,7 +387,7 @@ module Sensu
386
387
  adelete %r{/events?/([\w\.-]+)/([\w\.-]+)$} do |client_name, check_name|
387
388
  $redis.hgetall('events:' + client_name).callback do |events|
388
389
  if events.include?(check_name)
389
- resolve_event(client_name, check_name)
390
+ resolve_event(event_hash(events[check_name], client_name, check_name))
390
391
  accepted!
391
392
  else
392
393
  not_found!
@@ -402,7 +403,7 @@ module Sensu
402
403
  if client_name.is_a?(String) && check_name.is_a?(String)
403
404
  $redis.hgetall('events:' + client_name).callback do |events|
404
405
  if events.include?(check_name)
405
- resolve_event(client_name, check_name)
406
+ resolve_event(event_hash(events[check_name], client_name, check_name))
406
407
  accepted!
407
408
  else
408
409
  not_found!
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.9.8.beta.3'
3
+ VERSION = '0.9.8.beta.4'
4
4
  end
5
5
 
6
6
  unless defined?(Sensu::DEFAULT_OPTIONS)
data/lib/sensu/redis.rb CHANGED
@@ -39,7 +39,7 @@ module Sensu
39
39
  end
40
40
  end
41
41
  info.callback do |reply|
42
- redis_version = reply.split(/\n/).first.split(/:/).last.chomp
42
+ redis_version = reply.split(/\n/).select { |v| v =~ /^redis_version/ }.first.split(/:/).last.chomp
43
43
  if redis_version < '1.3.14'
44
44
  @logger.fatal('redis version must be >= 2.0 RC 1')
45
45
  close_connection
data/lib/sensu/server.rb CHANGED
@@ -160,14 +160,7 @@ module Sensu
160
160
  end
161
161
 
162
162
  def event_handlers(event)
163
- handler_list = case
164
- when event[:check].has_key?(:handlers)
165
- event[:check][:handlers]
166
- when event[:check].has_key?(:handler)
167
- [event[:check][:handler]]
168
- else
169
- ['default']
170
- end
163
+ handler_list = Array((event[:check][:handlers] || event[:check][:handler]) || 'default')
171
164
  handlers = derive_handlers(handler_list)
172
165
  event_severity = Sensu::SEVERITIES[event[:check][:status]] || 'unknown'
173
166
  handlers.select do |handler|
@@ -409,6 +402,7 @@ module Sensu
409
402
  :output => check[:output],
410
403
  :status => check[:status],
411
404
  :issued => check[:issued],
405
+ :handlers => Array((check[:handlers] || check[:handler]) || 'default'),
412
406
  :flapping => is_flapping,
413
407
  :occurrences => event[:occurrences]
414
408
  }.to_json).callback do
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.9.8.beta.3
4
+ version: 0.9.8.beta.4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-16 00:00:00.000000000 Z
13
+ date: 2012-11-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine
17
- requirement: &19119920 !ruby/object:Gem::Requirement
17
+ requirement: &17833920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - =
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *19119920
25
+ version_requirements: *17833920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: amqp
28
- requirement: &19040560 !ruby/object:Gem::Requirement
28
+ requirement: &17830820 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - =
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.9.7
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *19040560
36
+ version_requirements: *17830820
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: json
39
- requirement: &19037500 !ruby/object:Gem::Requirement
39
+ requirement: &17828500 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *19037500
47
+ version_requirements: *17828500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: cabin
50
- requirement: &18662780 !ruby/object:Gem::Requirement
50
+ requirement: &17453980 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - =
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.4.4
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *18662780
58
+ version_requirements: *17453980
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: ruby-redis
61
- requirement: &18661760 !ruby/object:Gem::Requirement
61
+ requirement: &17453060 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - =
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.0.2
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *18661760
69
+ version_requirements: *17453060
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: thin
72
- requirement: &18660860 !ruby/object:Gem::Requirement
72
+ requirement: &17451780 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - =
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.5.0
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *18660860
80
+ version_requirements: *17451780
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: async_sinatra
83
- requirement: &18658720 !ruby/object:Gem::Requirement
83
+ requirement: &17449880 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - =
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 1.0.0
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *18658720
91
+ version_requirements: *17449880
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rake
94
- requirement: &18657720 !ruby/object:Gem::Requirement
94
+ requirement: &17449020 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *18657720
102
+ version_requirements: *17449020
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: em-spec
105
- requirement: &18656940 !ruby/object:Gem::Requirement
105
+ requirement: &17448380 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *18656940
113
+ version_requirements: *17448380
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: em-http-request
116
- requirement: &18656480 !ruby/object:Gem::Requirement
116
+ requirement: &17447880 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,7 +121,7 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *18656480
124
+ version_requirements: *17447880
125
125
  description: A monitoring framework that aims to be simple, malleable, and scalable.
126
126
  Uses the publish/subscribe model.
127
127
  email: