sensu 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sensu/client.rb +3 -2
- data/lib/sensu/server.rb +6 -4
- data/sensu.gemspec +1 -1
- metadata +2 -2
data/lib/sensu/client.rb
CHANGED
@@ -6,7 +6,7 @@ module Sensu
|
|
6
6
|
EM.run do
|
7
7
|
client = self.new(options)
|
8
8
|
client.setup_amqp
|
9
|
-
client.
|
9
|
+
client.setup_keepalives
|
10
10
|
client.setup_subscriptions
|
11
11
|
|
12
12
|
Signal.trap('INT') do
|
@@ -31,7 +31,7 @@ module Sensu
|
|
31
31
|
@result_queue = @amq.queue('results')
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def setup_keepalives
|
35
35
|
keepalive_queue = @amq.queue('keepalives')
|
36
36
|
keepalive_queue.publish(@settings['client'].merge({'timestamp' => Time.now.to_i}).to_json)
|
37
37
|
EM.add_periodic_timer(30) do
|
@@ -76,6 +76,7 @@ module Sensu
|
|
76
76
|
end
|
77
77
|
EM.add_periodic_timer(0.5) do
|
78
78
|
unless uniq_queue.subscribed?
|
79
|
+
uniq_queue.unsubscribe
|
79
80
|
uniq_queue.subscribe do |check_json|
|
80
81
|
check = JSON.parse(check_json)
|
81
82
|
execute_check(check)
|
data/lib/sensu/server.rb
CHANGED
@@ -12,11 +12,11 @@ module Sensu
|
|
12
12
|
server.setup_logging
|
13
13
|
server.setup_redis
|
14
14
|
server.setup_amqp
|
15
|
-
server.
|
15
|
+
server.setup_keepalives
|
16
16
|
server.setup_handlers
|
17
17
|
server.setup_results
|
18
18
|
server.setup_publisher
|
19
|
-
server.
|
19
|
+
server.setup_keepalive_monitor
|
20
20
|
|
21
21
|
Signal.trap('INT') do
|
22
22
|
EM.stop
|
@@ -47,10 +47,11 @@ module Sensu
|
|
47
47
|
@amq = MQ.new(connection)
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def setup_keepalives
|
51
51
|
keepalive_queue = @amq.queue('keepalives')
|
52
52
|
EM.add_periodic_timer(0.5) do
|
53
53
|
unless keepalive_queue.subscribed?
|
54
|
+
keepalive_queue.unsubscribe
|
54
55
|
keepalive_queue.subscribe do |keepalive_json|
|
55
56
|
client = JSON.parse(keepalive_json)['name']
|
56
57
|
@redis.set('client:' + client, keepalive_json).callback do
|
@@ -134,6 +135,7 @@ module Sensu
|
|
134
135
|
result_queue = @amq.queue('results')
|
135
136
|
EM.add_periodic_timer(0.5) do
|
136
137
|
unless result_queue.subscribed?
|
138
|
+
result_queue.unsubscribe
|
137
139
|
result_queue.subscribe do |result_json|
|
138
140
|
result = JSON.parse(result_json)
|
139
141
|
process_result(result)
|
@@ -161,7 +163,7 @@ module Sensu
|
|
161
163
|
end
|
162
164
|
end
|
163
165
|
|
164
|
-
def
|
166
|
+
def setup_keepalive_monitor
|
165
167
|
result_queue = @amq.queue('results')
|
166
168
|
EM.add_periodic_timer(30) do
|
167
169
|
@redis.smembers('clients').callback do |clients|
|
data/sensu.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: sensu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Porter
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-09-
|
14
|
+
date: 2011-09-19 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: amqp
|