sensu 0.9.8.beta.2 → 0.9.8.beta.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -14,6 +14,8 @@ Fixed flap detection.
14
14
 
15
15
  Gracefully handle possible failed RabbitMQ authentication.
16
16
 
17
+ Catch and log AMQP channel errors, which cause the channel to close.
18
+
17
19
  ## 0.9.7 - 2012-09-20
18
20
 
19
21
  ### Features
data/lib/sensu/api.rb CHANGED
@@ -311,20 +311,29 @@ module Sensu
311
311
  begin
312
312
  post_body = JSON.parse(request.body.read, :symbolize_names => true)
313
313
  check_name = post_body[:check]
314
- subscribers = post_body[:subscribers]
314
+ subscribers = post_body[:subscribers] || Array.new
315
315
  if check_name.is_a?(String) && subscribers.is_a?(Array)
316
- payload = {
317
- :name => check_name,
318
- :issued => Time.now.to_i
319
- }
320
- $logger.info('publishing check request', {
321
- :payload => payload,
322
- :subscribers => subscribers
323
- })
324
- subscribers.uniq.each do |exchange_name|
325
- $amq.fanout(exchange_name).publish(payload.to_json)
316
+ if $settings.check_exists?(check_name)
317
+ check = $settings[:checks][check_name]
318
+ if subscribers.empty?
319
+ subscribers = check[:subscribers] || Array.new
320
+ end
321
+ payload = {
322
+ :name => check_name,
323
+ :command => check[:command],
324
+ :issued => Time.now.to_i
325
+ }
326
+ $logger.info('publishing check request', {
327
+ :payload => payload,
328
+ :subscribers => subscribers
329
+ })
330
+ subscribers.uniq.each do |exchange_name|
331
+ $amq.fanout(exchange_name).publish(payload.to_json)
332
+ end
333
+ created!
334
+ else
335
+ not_found!
326
336
  end
327
- created!
328
337
  else
329
338
  bad_request!
330
339
  end
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.9.8.beta.2'
3
+ VERSION = '0.9.8.beta.3'
4
4
  end
5
5
 
6
6
  unless defined?(Sensu::DEFAULT_OPTIONS)
data/lib/sensu/server.rb CHANGED
@@ -76,6 +76,15 @@ module Sensu
76
76
  end
77
77
  @amq = AMQP::Channel.new(@rabbitmq)
78
78
  @amq.auto_recovery = true
79
+ @amq.on_error do |channel, channel_close|
80
+ @logger.fatal('rabbitmq channel closed', {
81
+ :error => {
82
+ :reply_code => channel_close.reply_code,
83
+ :reply_text => channel_close.reply_text
84
+ }
85
+ })
86
+ stop
87
+ end
79
88
  end
80
89
 
81
90
  def setup_keepalives
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.2
4
+ version: 0.9.8.beta.3
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-08 00:00:00.000000000 Z
13
+ date: 2012-10-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine
17
- requirement: &9708760 !ruby/object:Gem::Requirement
17
+ requirement: &19119920 !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: *9708760
25
+ version_requirements: *19119920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: amqp
28
- requirement: &9707060 !ruby/object:Gem::Requirement
28
+ requirement: &19040560 !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: *9707060
36
+ version_requirements: *19040560
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: json
39
- requirement: &9706020 !ruby/object:Gem::Requirement
39
+ requirement: &19037500 !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: *9706020
47
+ version_requirements: *19037500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: cabin
50
- requirement: &9703280 !ruby/object:Gem::Requirement
50
+ requirement: &18662780 !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: *9703280
58
+ version_requirements: *18662780
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: ruby-redis
61
- requirement: &9700500 !ruby/object:Gem::Requirement
61
+ requirement: &18661760 !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: *9700500
69
+ version_requirements: *18661760
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: thin
72
- requirement: &9698660 !ruby/object:Gem::Requirement
72
+ requirement: &18660860 !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: *9698660
80
+ version_requirements: *18660860
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: async_sinatra
83
- requirement: &9697480 !ruby/object:Gem::Requirement
83
+ requirement: &18658720 !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: *9697480
91
+ version_requirements: *18658720
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rake
94
- requirement: &9696760 !ruby/object:Gem::Requirement
94
+ requirement: &18657720 !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: *9696760
102
+ version_requirements: *18657720
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: em-spec
105
- requirement: &9696120 !ruby/object:Gem::Requirement
105
+ requirement: &18656940 !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: *9696120
113
+ version_requirements: *18656940
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: em-http-request
116
- requirement: &9695580 !ruby/object:Gem::Requirement
116
+ requirement: &18656480 !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: *9695580
124
+ version_requirements: *18656480
125
125
  description: A monitoring framework that aims to be simple, malleable, and scalable.
126
126
  Uses the publish/subscribe model.
127
127
  email: