sensu 0.9.11 → 0.9.12.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +20 -0
- data/lib/sensu/api.rb +44 -37
- data/lib/sensu/base.rb +19 -10
- data/lib/sensu/cli.rb +4 -4
- data/lib/sensu/client.rb +103 -68
- data/lib/sensu/constants.rb +5 -7
- data/lib/sensu/extensions.rb +9 -3
- data/lib/sensu/extensions/handlers/debug.rb +1 -1
- data/lib/sensu/logstream.rb +49 -22
- data/lib/sensu/rabbitmq.rb +2 -2
- data/lib/sensu/server.rb +59 -55
- data/lib/sensu/settings.rb +182 -248
- data/lib/sensu/socket.rb +12 -12
- data/sensu.gemspec +3 -5
- metadata +37 -64
data/lib/sensu/socket.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
module Sensu
|
2
2
|
class Socket < EM::Connection
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :logger, :settings, :amq, :reply
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def respond(data)
|
6
|
+
unless @reply == false
|
7
7
|
send_data(data)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def receive_data(data)
|
12
|
-
if data =~ /[\x80-\xff]/
|
12
|
+
if data =~ /[\x80-\xff]/n
|
13
13
|
@logger.warn('socket received non-ascii characters')
|
14
|
-
|
14
|
+
respond('invalid')
|
15
15
|
elsif data.strip == 'ping'
|
16
16
|
@logger.debug('socket received ping')
|
17
|
-
|
17
|
+
respond('pong')
|
18
18
|
else
|
19
19
|
@logger.debug('socket received data', {
|
20
20
|
:data => data
|
21
21
|
})
|
22
22
|
begin
|
23
|
-
check =
|
23
|
+
check = Oj.load(data)
|
24
24
|
validates = [:name, :output].all? do |key|
|
25
25
|
check[key].is_a?(String)
|
26
26
|
end
|
@@ -34,20 +34,20 @@ module Sensu
|
|
34
34
|
@logger.info('publishing check result', {
|
35
35
|
:payload => payload
|
36
36
|
})
|
37
|
-
@amq.direct('results').publish(payload
|
38
|
-
|
37
|
+
@amq.direct('results').publish(Oj.dump(payload))
|
38
|
+
respond('ok')
|
39
39
|
else
|
40
40
|
@logger.warn('invalid check result', {
|
41
41
|
:check => check
|
42
42
|
})
|
43
|
-
|
43
|
+
respond('invalid')
|
44
44
|
end
|
45
|
-
rescue
|
45
|
+
rescue Oj::ParseError => error
|
46
46
|
@logger.warn('check result must be valid json', {
|
47
47
|
:data => data,
|
48
48
|
:error => error.to_s
|
49
49
|
})
|
50
|
-
|
50
|
+
respond('invalid')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/sensu.gemspec
CHANGED
@@ -13,11 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.has_rdoc = false
|
15
15
|
|
16
|
-
s.add_dependency('
|
17
|
-
s.add_dependency('
|
18
|
-
s.add_dependency('amqp', '0.9.
|
19
|
-
s.add_dependency('json')
|
20
|
-
s.add_dependency('cabin', '0.4.4')
|
16
|
+
s.add_dependency('oj', '2.0.8')
|
17
|
+
s.add_dependency('eventmachine', '1.0.1')
|
18
|
+
s.add_dependency('amqp', '0.9.9')
|
21
19
|
s.add_dependency('em-redis-unified', '0.4.1')
|
22
20
|
s.add_dependency('thin', '1.5.0')
|
23
21
|
s.add_dependency('async_sinatra', '1.0.0')
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 1382106394
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
|
9
|
+
- 12
|
10
|
+
- beta
|
11
|
+
version: 0.9.12.beta
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Sean Porter
|
@@ -16,39 +17,39 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2013-
|
20
|
+
date: 2013-03-03 00:00:00 -08:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
|
-
name:
|
24
|
+
name: oj
|
24
25
|
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
27
|
none: false
|
27
28
|
requirements:
|
28
29
|
- - "="
|
29
30
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
31
|
+
hash: 31
|
31
32
|
segments:
|
32
|
-
-
|
33
|
+
- 2
|
33
34
|
- 0
|
34
|
-
-
|
35
|
-
version:
|
35
|
+
- 8
|
36
|
+
version: 2.0.8
|
36
37
|
type: :runtime
|
37
38
|
version_requirements: *id001
|
38
39
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
40
|
+
name: eventmachine
|
40
41
|
prerelease: false
|
41
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
43
|
none: false
|
43
44
|
requirements:
|
44
45
|
- - "="
|
45
46
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
47
|
+
hash: 21
|
47
48
|
segments:
|
49
|
+
- 1
|
48
50
|
- 0
|
49
|
-
-
|
50
|
-
|
51
|
-
version: 0.9.11
|
51
|
+
- 1
|
52
|
+
version: 1.0.1
|
52
53
|
type: :runtime
|
53
54
|
version_requirements: *id002
|
54
55
|
- !ruby/object:Gem::Dependency
|
@@ -59,48 +60,18 @@ dependencies:
|
|
59
60
|
requirements:
|
60
61
|
- - "="
|
61
62
|
- !ruby/object:Gem::Version
|
62
|
-
hash:
|
63
|
+
hash: 41
|
63
64
|
segments:
|
64
65
|
- 0
|
65
66
|
- 9
|
66
|
-
-
|
67
|
-
version: 0.9.
|
67
|
+
- 9
|
68
|
+
version: 0.9.9
|
68
69
|
type: :runtime
|
69
70
|
version_requirements: *id003
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: json
|
72
|
-
prerelease: false
|
73
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 3
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
version: "0"
|
82
|
-
type: :runtime
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: cabin
|
86
|
-
prerelease: false
|
87
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
|
-
requirements:
|
90
|
-
- - "="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
hash: 7
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
- 4
|
96
|
-
- 4
|
97
|
-
version: 0.4.4
|
98
|
-
type: :runtime
|
99
|
-
version_requirements: *id005
|
100
71
|
- !ruby/object:Gem::Dependency
|
101
72
|
name: em-redis-unified
|
102
73
|
prerelease: false
|
103
|
-
requirement: &
|
74
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
104
75
|
none: false
|
105
76
|
requirements:
|
106
77
|
- - "="
|
@@ -112,11 +83,11 @@ dependencies:
|
|
112
83
|
- 1
|
113
84
|
version: 0.4.1
|
114
85
|
type: :runtime
|
115
|
-
version_requirements: *
|
86
|
+
version_requirements: *id004
|
116
87
|
- !ruby/object:Gem::Dependency
|
117
88
|
name: thin
|
118
89
|
prerelease: false
|
119
|
-
requirement: &
|
90
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
120
91
|
none: false
|
121
92
|
requirements:
|
122
93
|
- - "="
|
@@ -128,11 +99,11 @@ dependencies:
|
|
128
99
|
- 0
|
129
100
|
version: 1.5.0
|
130
101
|
type: :runtime
|
131
|
-
version_requirements: *
|
102
|
+
version_requirements: *id005
|
132
103
|
- !ruby/object:Gem::Dependency
|
133
104
|
name: async_sinatra
|
134
105
|
prerelease: false
|
135
|
-
requirement: &
|
106
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
136
107
|
none: false
|
137
108
|
requirements:
|
138
109
|
- - "="
|
@@ -144,11 +115,11 @@ dependencies:
|
|
144
115
|
- 0
|
145
116
|
version: 1.0.0
|
146
117
|
type: :runtime
|
147
|
-
version_requirements: *
|
118
|
+
version_requirements: *id006
|
148
119
|
- !ruby/object:Gem::Dependency
|
149
120
|
name: rake
|
150
121
|
prerelease: false
|
151
|
-
requirement: &
|
122
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
152
123
|
none: false
|
153
124
|
requirements:
|
154
125
|
- - ">="
|
@@ -158,11 +129,11 @@ dependencies:
|
|
158
129
|
- 0
|
159
130
|
version: "0"
|
160
131
|
type: :development
|
161
|
-
version_requirements: *
|
132
|
+
version_requirements: *id007
|
162
133
|
- !ruby/object:Gem::Dependency
|
163
134
|
name: rspec
|
164
135
|
prerelease: false
|
165
|
-
requirement: &
|
136
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
166
137
|
none: false
|
167
138
|
requirements:
|
168
139
|
- - ">="
|
@@ -172,11 +143,11 @@ dependencies:
|
|
172
143
|
- 0
|
173
144
|
version: "0"
|
174
145
|
type: :development
|
175
|
-
version_requirements: *
|
146
|
+
version_requirements: *id008
|
176
147
|
- !ruby/object:Gem::Dependency
|
177
148
|
name: em-http-request
|
178
149
|
prerelease: false
|
179
|
-
requirement: &
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
180
151
|
none: false
|
181
152
|
requirements:
|
182
153
|
- - ">="
|
@@ -186,7 +157,7 @@ dependencies:
|
|
186
157
|
- 0
|
187
158
|
version: "0"
|
188
159
|
type: :development
|
189
|
-
version_requirements: *
|
160
|
+
version_requirements: *id009
|
190
161
|
description: A monitoring framework that aims to be simple, malleable, and scalable. Uses the publish/subscribe model.
|
191
162
|
email:
|
192
163
|
- portertech@gmail.com
|
@@ -247,12 +218,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
219
|
none: false
|
249
220
|
requirements:
|
250
|
-
- - "
|
221
|
+
- - ">"
|
251
222
|
- !ruby/object:Gem::Version
|
252
|
-
hash:
|
223
|
+
hash: 25
|
253
224
|
segments:
|
254
|
-
-
|
255
|
-
|
225
|
+
- 1
|
226
|
+
- 3
|
227
|
+
- 1
|
228
|
+
version: 1.3.1
|
256
229
|
requirements: []
|
257
230
|
|
258
231
|
rubyforge_project:
|