sensu 0.9.10 → 0.9.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +20 -0
- data/README.md +3 -4
- data/lib/sensu/api.rb +34 -38
- data/lib/sensu/client.rb +2 -2
- data/lib/sensu/constants.rb +1 -1
- data/lib/sensu/extensions.rb +2 -1
- data/lib/sensu/server.rb +3 -1
- data/lib/sensu/settings.rb +2 -1
- data/lib/sensu/socket.rb +5 -2
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 0.9.11 - 2013-02-22
|
2
|
+
|
3
|
+
### Features
|
4
|
+
|
5
|
+
API aggregate age filter parameter.
|
6
|
+
|
7
|
+
### Non-backwards compatible changes
|
8
|
+
|
9
|
+
Removed /info "health" in favour of RabbitMQ & Redis "connected".
|
10
|
+
|
11
|
+
### Other
|
12
|
+
|
13
|
+
No longer using the default AMQP exchange or publishing directly to queues.
|
14
|
+
|
15
|
+
Removed API health filter, as the Redis connection now recovers.
|
16
|
+
|
17
|
+
Fixed config & extension directory loading on Windows.
|
18
|
+
|
19
|
+
Client socket handles non-ascii input.
|
20
|
+
|
1
21
|
## 0.9.10 - 2013-01-30
|
2
22
|
|
3
23
|
### Features
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
A monitoring framework that aims to be simple, malleable, and scalable.
|
1
|
+
![sensu](https://raw.github.com/sensu/sensu/master/sensu-logo.png)
|
3
2
|
|
4
|
-
|
3
|
+
A monitoring framework that aims to be simple, malleable, and scalable.
|
5
4
|
|
6
|
-
|
5
|
+
![travis](https://secure.travis-ci.org/sensu/sensu.png)
|
7
6
|
|
8
7
|
## Documentation
|
9
8
|
Please refer to the [Sensu Wiki](https://github.com/sensu/sensu/wiki).
|
data/lib/sensu/api.rb
CHANGED
@@ -128,22 +128,12 @@ module Sensu
|
|
128
128
|
env['rack.input'].rewind
|
129
129
|
end
|
130
130
|
|
131
|
-
def health_filter
|
132
|
-
unless $redis.connected?
|
133
|
-
unless env['REQUEST_PATH'] == '/info'
|
134
|
-
halt 500
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
131
|
def bad_request!
|
140
|
-
|
141
|
-
body ''
|
132
|
+
ahalt 400
|
142
133
|
end
|
143
134
|
|
144
135
|
def not_found!
|
145
|
-
|
146
|
-
body ''
|
136
|
+
ahalt 404
|
147
137
|
end
|
148
138
|
|
149
139
|
def created!
|
@@ -183,14 +173,13 @@ module Sensu
|
|
183
173
|
$logger.info('publishing check result', {
|
184
174
|
:payload => payload
|
185
175
|
})
|
186
|
-
$amq.
|
176
|
+
$amq.direct('results').publish(payload.to_json)
|
187
177
|
end
|
188
178
|
end
|
189
179
|
|
190
180
|
before do
|
191
|
-
content_type 'application/json'
|
192
181
|
request_log_line
|
193
|
-
|
182
|
+
content_type 'application/json'
|
194
183
|
end
|
195
184
|
|
196
185
|
aget '/info' do
|
@@ -206,11 +195,11 @@ module Sensu
|
|
206
195
|
:results => {
|
207
196
|
:messages => nil,
|
208
197
|
:consumers => nil
|
209
|
-
}
|
198
|
+
},
|
199
|
+
:connected => $rabbitmq.connected?
|
210
200
|
},
|
211
|
-
:
|
212
|
-
:
|
213
|
-
:rabbitmq => $rabbitmq.connected? ? 'ok' : 'down'
|
201
|
+
:redis => {
|
202
|
+
:connected => $redis.connected?
|
214
203
|
}
|
215
204
|
}
|
216
205
|
if $rabbitmq.connected?
|
@@ -412,25 +401,17 @@ module Sensu
|
|
412
401
|
response = Array.new
|
413
402
|
$redis.smembers('aggregates') do |checks|
|
414
403
|
unless checks.empty?
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
:issued => aggregates.sort.reverse.take(limit)
|
425
|
-
}
|
426
|
-
response.push(collection)
|
427
|
-
if index == checks.size - 1
|
428
|
-
body response.to_json
|
429
|
-
end
|
404
|
+
checks.each_with_index do |check_name, index|
|
405
|
+
$redis.smembers('aggregates:' + check_name) do |aggregates|
|
406
|
+
collection = {
|
407
|
+
:check => check_name,
|
408
|
+
:issued => aggregates.sort.reverse
|
409
|
+
}
|
410
|
+
response.push(collection)
|
411
|
+
if index == checks.size - 1
|
412
|
+
body response.to_json
|
430
413
|
end
|
431
414
|
end
|
432
|
-
else
|
433
|
-
bad_request!
|
434
415
|
end
|
435
416
|
else
|
436
417
|
body response.to_json
|
@@ -441,11 +422,26 @@ module Sensu
|
|
441
422
|
aget %r{/aggregates/([\w\.-]+)$} do |check_name|
|
442
423
|
$redis.smembers('aggregates:' + check_name) do |aggregates|
|
443
424
|
unless aggregates.empty?
|
425
|
+
valid_request = true
|
426
|
+
if params[:age]
|
427
|
+
if params[:age] =~ /^[0-9]+$/
|
428
|
+
timestamp = Time.now.to_i - params[:age].to_i
|
429
|
+
aggregates.reject! do |issued|
|
430
|
+
issued.to_i > timestamp
|
431
|
+
end
|
432
|
+
else
|
433
|
+
valid_request = false
|
434
|
+
end
|
435
|
+
end
|
444
436
|
limit = 10
|
445
437
|
if params[:limit]
|
446
|
-
|
438
|
+
if params[:limit] =~ /^[0-9]+$/
|
439
|
+
limit = params[:limit].to_i
|
440
|
+
else
|
441
|
+
valid_request = false
|
442
|
+
end
|
447
443
|
end
|
448
|
-
|
444
|
+
if valid_request
|
449
445
|
body aggregates.sort.reverse.take(limit).to_json
|
450
446
|
else
|
451
447
|
bad_request!
|
data/lib/sensu/client.rb
CHANGED
@@ -50,7 +50,7 @@ module Sensu
|
|
50
50
|
@logger.debug('publishing keepalive', {
|
51
51
|
:payload => payload
|
52
52
|
})
|
53
|
-
@amq.
|
53
|
+
@amq.direct('keepalives').publish(payload.to_json)
|
54
54
|
end
|
55
55
|
|
56
56
|
def setup_keepalives
|
@@ -71,7 +71,7 @@ module Sensu
|
|
71
71
|
@logger.info('publishing check result', {
|
72
72
|
:payload => payload
|
73
73
|
})
|
74
|
-
@amq.
|
74
|
+
@amq.direct('results').publish(payload.to_json)
|
75
75
|
end
|
76
76
|
|
77
77
|
def execute_check(check)
|
data/lib/sensu/constants.rb
CHANGED
data/lib/sensu/extensions.rb
CHANGED
@@ -19,7 +19,8 @@ module Sensu
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def require_directory(directory)
|
22
|
-
|
22
|
+
path = directory.gsub(/\\(?=\S)/, '/')
|
23
|
+
Dir.glob(File.join(path, '**/*.rb')).each do |file|
|
23
24
|
begin
|
24
25
|
require file
|
25
26
|
rescue ScriptError => error
|
data/lib/sensu/server.rb
CHANGED
@@ -81,6 +81,7 @@ module Sensu
|
|
81
81
|
consumer.cancel
|
82
82
|
end
|
83
83
|
@keepalive_queue = @amq.queue!('keepalives')
|
84
|
+
@keepalive_queue.bind(@amq.direct('keepalives'))
|
84
85
|
@keepalive_queue.subscribe(:ack => true) do |header, payload|
|
85
86
|
client = JSON.parse(payload, :symbolize_names => true)
|
86
87
|
@logger.debug('received keepalive', {
|
@@ -518,6 +519,7 @@ module Sensu
|
|
518
519
|
consumer.cancel
|
519
520
|
end
|
520
521
|
@result_queue = @amq.queue!('results')
|
522
|
+
@result_queue.bind(@amq.direct('results'))
|
521
523
|
@result_queue.subscribe(:ack => true) do |header, payload|
|
522
524
|
result = JSON.parse(payload, :symbolize_names => true)
|
523
525
|
@logger.debug('received result', {
|
@@ -577,7 +579,7 @@ module Sensu
|
|
577
579
|
@logger.info('publishing check result', {
|
578
580
|
:payload => payload
|
579
581
|
})
|
580
|
-
@amq.
|
582
|
+
@amq.direct('results').publish(payload.to_json)
|
581
583
|
end
|
582
584
|
|
583
585
|
def determine_stale_clients
|
data/lib/sensu/settings.rb
CHANGED
@@ -104,7 +104,8 @@ module Sensu
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def load_directory(directory)
|
107
|
-
|
107
|
+
path = directory.gsub(/\\(?=\S)/, '/')
|
108
|
+
Dir.glob(File.join(path, '**/*.json')).each do |file|
|
108
109
|
load_file(file)
|
109
110
|
end
|
110
111
|
end
|
data/lib/sensu/socket.rb
CHANGED
@@ -9,7 +9,10 @@ module Sensu
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def receive_data(data)
|
12
|
-
if data
|
12
|
+
if data =~ /[\x80-\xff]/
|
13
|
+
@logger.warn('socket received non-ascii characters')
|
14
|
+
reply('invalid')
|
15
|
+
elsif data.strip == 'ping'
|
13
16
|
@logger.debug('socket received ping')
|
14
17
|
reply('pong')
|
15
18
|
else
|
@@ -31,7 +34,7 @@ module Sensu
|
|
31
34
|
@logger.info('publishing check result', {
|
32
35
|
:payload => payload
|
33
36
|
})
|
34
|
-
@amq.
|
37
|
+
@amq.direct('results').publish(payload.to_json)
|
35
38
|
reply('ok')
|
36
39
|
else
|
37
40
|
@logger.warn('invalid check result', {
|
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:
|
4
|
+
hash: 45
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 11
|
10
|
+
version: 0.9.11
|
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-
|
19
|
+
date: 2013-02-22 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|