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/lib/sensu/socket.rb CHANGED
@@ -1,26 +1,26 @@
1
1
  module Sensu
2
2
  class Socket < EM::Connection
3
- attr_accessor :protocol, :logger, :settings, :amq
3
+ attr_accessor :logger, :settings, :amq, :reply
4
4
 
5
- def reply(data)
6
- if @protocol == :tcp
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
- reply('invalid')
14
+ respond('invalid')
15
15
  elsif data.strip == 'ping'
16
16
  @logger.debug('socket received ping')
17
- reply('pong')
17
+ respond('pong')
18
18
  else
19
19
  @logger.debug('socket received data', {
20
20
  :data => data
21
21
  })
22
22
  begin
23
- check = JSON.parse(data, :symbolize_names => true)
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.to_json)
38
- reply('ok')
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
- reply('invalid')
43
+ respond('invalid')
44
44
  end
45
- rescue JSON::ParserError => error
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
- reply('invalid')
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('eventmachine', '1.0.0')
17
- s.add_dependency('amq-client', '0.9.11')
18
- s.add_dependency('amqp', '0.9.8')
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: 45
5
- prerelease: false
4
+ hash: 1382106394
5
+ prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 11
10
- version: 0.9.11
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-02-22 00:00:00 -08:00
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: eventmachine
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: 23
31
+ hash: 31
31
32
  segments:
32
- - 1
33
+ - 2
33
34
  - 0
34
- - 0
35
- version: 1.0.0
35
+ - 8
36
+ version: 2.0.8
36
37
  type: :runtime
37
38
  version_requirements: *id001
38
39
  - !ruby/object:Gem::Dependency
39
- name: amq-client
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: 45
47
+ hash: 21
47
48
  segments:
49
+ - 1
48
50
  - 0
49
- - 9
50
- - 11
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: 43
63
+ hash: 41
63
64
  segments:
64
65
  - 0
65
66
  - 9
66
- - 8
67
- version: 0.9.8
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: &id006 !ruby/object:Gem::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: *id006
86
+ version_requirements: *id004
116
87
  - !ruby/object:Gem::Dependency
117
88
  name: thin
118
89
  prerelease: false
119
- requirement: &id007 !ruby/object:Gem::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: *id007
102
+ version_requirements: *id005
132
103
  - !ruby/object:Gem::Dependency
133
104
  name: async_sinatra
134
105
  prerelease: false
135
- requirement: &id008 !ruby/object:Gem::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: *id008
118
+ version_requirements: *id006
148
119
  - !ruby/object:Gem::Dependency
149
120
  name: rake
150
121
  prerelease: false
151
- requirement: &id009 !ruby/object:Gem::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: *id009
132
+ version_requirements: *id007
162
133
  - !ruby/object:Gem::Dependency
163
134
  name: rspec
164
135
  prerelease: false
165
- requirement: &id010 !ruby/object:Gem::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: *id010
146
+ version_requirements: *id008
176
147
  - !ruby/object:Gem::Dependency
177
148
  name: em-http-request
178
149
  prerelease: false
179
- requirement: &id011 !ruby/object:Gem::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: *id011
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: 3
223
+ hash: 25
253
224
  segments:
254
- - 0
255
- version: "0"
225
+ - 1
226
+ - 3
227
+ - 1
228
+ version: 1.3.1
256
229
  requirements: []
257
230
 
258
231
  rubyforge_project: