sensu 0.9.12.beta.3 → 0.9.12.beta.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ### Features
4
4
 
5
+ API can bind to a specific address.
6
+
5
7
  Extension stop hook for clean up before the event loop is stopped.
6
8
 
7
9
  Check extensions.
@@ -12,6 +14,8 @@ No longer defaults to or enforces a specific config file or directory.
12
14
 
13
15
  ### Other
14
16
 
17
+ API 201 & 202 status responses return a body.
18
+
15
19
  Improved RabbitMQ queue unsubscribe & connection reconnect.
16
20
 
17
21
  Fixed keepalive check history & flap detection.
data/lib/sensu/api.rb CHANGED
@@ -75,7 +75,8 @@ module Sensu
75
75
  setup_redis
76
76
  setup_rabbitmq
77
77
  Thin::Logging.silent = true
78
- Thin::Server.start(self, $settings[:api][:port])
78
+ bind = $settings[:api][:bind] || '0.0.0.0'
79
+ Thin::Server.start(bind, $settings[:api][:port], self)
79
80
  end
80
81
 
81
82
  def stop
@@ -143,14 +144,14 @@ module Sensu
143
144
  ahalt 404
144
145
  end
145
146
 
146
- def created!
147
+ def created!(response)
147
148
  status 201
148
- body ''
149
+ body response
149
150
  end
150
151
 
151
- def accepted!
152
+ def accepted!(response)
152
153
  status 202
153
- body ''
154
+ body response
154
155
  end
155
156
 
156
157
  def no_content!
@@ -274,7 +275,7 @@ module Sensu
274
275
  $redis.del('history:' + client_name)
275
276
  end
276
277
  end
277
- accepted!
278
+ accepted!(Oj.dump({:issued => Time.now.to_i}))
278
279
  end
279
280
  else
280
281
  not_found!
@@ -318,7 +319,7 @@ module Sensu
318
319
  subscribers.uniq.each do |exchange_name|
319
320
  $amq.fanout(exchange_name).publish(Oj.dump(payload))
320
321
  end
321
- created!
322
+ created!(Oj.dump(payload))
322
323
  else
323
324
  not_found!
324
325
  end
@@ -375,7 +376,7 @@ module Sensu
375
376
  $redis.hgetall('events:' + client_name) do |events|
376
377
  if events.include?(check_name)
377
378
  resolve_event(event_hash(events[check_name], client_name, check_name))
378
- accepted!
379
+ accepted!(Oj.dump({:issued => Time.now.to_i}))
379
380
  else
380
381
  not_found!
381
382
  end
@@ -391,7 +392,7 @@ module Sensu
391
392
  $redis.hgetall('events:' + client_name) do |events|
392
393
  if events.include?(check_name)
393
394
  resolve_event(event_hash(events[check_name], client_name, check_name))
394
- accepted!
395
+ accepted!(Oj.dump({:issued => Time.now.to_i}))
395
396
  else
396
397
  not_found!
397
398
  end
@@ -517,7 +518,7 @@ module Sensu
517
518
  post_body = Oj.load(request.body.read)
518
519
  $redis.set('stash:' + path, Oj.dump(post_body)) do
519
520
  $redis.sadd('stashes', path) do
520
- created!
521
+ created!(Oj.dump({:issued => Time.now.to_i}))
521
522
  end
522
523
  end
523
524
  rescue Oj::ParseError
data/lib/sensu/base.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
 
3
3
  gem 'oj', '2.0.9'
4
- gem 'eventmachine', '1.0.1'
4
+ gem 'eventmachine', '1.0.3'
5
5
 
6
6
  require 'time'
7
7
  require 'uri'
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.9.12.beta.3'
3
+ VERSION = '0.9.12.beta.4'
4
4
 
5
5
  LOG_LEVELS = [:debug, :info, :warn, :error, :fatal]
6
6
 
@@ -1,4 +1,4 @@
1
- gem 'amqp', '0.9.9'
1
+ gem 'amqp', '0.9.10'
2
2
 
3
3
  require 'amqp'
4
4
 
@@ -216,6 +216,11 @@ module Sensu
216
216
  unless check[:command].is_a?(String)
217
217
  invalid_check(check, 'check is missing command')
218
218
  end
219
+ if check.has_key?(:standalone)
220
+ unless !!check[:standalone] == check[:standalone]
221
+ invalid_check(check, 'check standalone must be boolean')
222
+ end
223
+ end
219
224
  unless check[:standalone]
220
225
  unless check[:subscribers].is_a?(Array)
221
226
  invalid_check(check, 'check is missing subscribers')
data/sensu.gemspec CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.has_rdoc = false
15
15
 
16
16
  s.add_dependency('oj', '2.0.9')
17
- s.add_dependency('eventmachine', '1.0.1')
18
- s.add_dependency('amqp', '0.9.9')
17
+ s.add_dependency('eventmachine', '1.0.3')
18
+ s.add_dependency('amqp', '0.9.10')
19
19
  s.add_dependency('em-redis-unified', '0.4.1')
20
20
  s.add_dependency('thin', '1.5.0')
21
21
  s.add_dependency('async_sinatra', '1.0.0')
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 2789372299
4
+ hash: 3135244901
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 12
10
10
  - beta
11
- - 3
12
- version: 0.9.12.beta.3
11
+ - 4
12
+ version: 0.9.12.beta.4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sean Porter
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2013-03-06 00:00:00 -08:00
21
+ date: 2013-03-08 00:00:00 -08:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -45,12 +45,12 @@ dependencies:
45
45
  requirements:
46
46
  - - "="
47
47
  - !ruby/object:Gem::Version
48
- hash: 21
48
+ hash: 17
49
49
  segments:
50
50
  - 1
51
51
  - 0
52
- - 1
53
- version: 1.0.1
52
+ - 3
53
+ version: 1.0.3
54
54
  type: :runtime
55
55
  version_requirements: *id002
56
56
  - !ruby/object:Gem::Dependency
@@ -61,12 +61,12 @@ dependencies:
61
61
  requirements:
62
62
  - - "="
63
63
  - !ruby/object:Gem::Version
64
- hash: 41
64
+ hash: 47
65
65
  segments:
66
66
  - 0
67
67
  - 9
68
- - 9
69
- version: 0.9.9
68
+ - 10
69
+ version: 0.9.10
70
70
  type: :runtime
71
71
  version_requirements: *id003
72
72
  - !ruby/object:Gem::Dependency