sensu 0.11.0.beta → 0.11.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -14,6 +14,10 @@ as an argument to run.
14
14
  You can specify the Sensu log severity level using the -L (--log_level)
15
15
  CLI argument, providing a valid level (eg. warn).
16
16
 
17
+ You can specify custom sensitive Sensu client key/values to be redacted
18
+ from log events and keepalives, eg. "client": { "redact":
19
+ ["secret_access_key"] }.
20
+
17
21
  ### Other
18
22
 
19
23
  Sensu passes a dup of event data to mutator & handler extensions to
@@ -23,6 +27,10 @@ Extension runs are wrapped in a begin/rescue block, a safety net.
23
27
 
24
28
  UDP handler now binds to "0.0.0.0".
25
29
 
30
+ Faster JSON parser.
31
+
32
+ Missing AMQP connection heartbeats will result in a reconnect.
33
+
26
34
  ## 0.10.2 - 2013-07-18
27
35
 
28
36
  ### Other
data/lib/sensu/base.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'oj', '2.0.9'
3
+ gem 'oj', '2.1.4'
4
4
  gem 'eventmachine', '1.0.3'
5
5
 
6
6
  require 'time'
data/lib/sensu/client.rb CHANGED
@@ -49,7 +49,7 @@ module Sensu
49
49
 
50
50
  def publish_keepalive
51
51
  keepalive = @settings[:client].merge(:timestamp => Time.now.to_i)
52
- payload = redact_passwords(keepalive)
52
+ payload = redact_sensitive(keepalive, @settings[:client][:redact])
53
53
  @logger.debug('publishing keepalive', {
54
54
  :payload => payload
55
55
  })
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.11.0.beta'
3
+ VERSION = '0.11.0.beta.1'
4
4
 
5
5
  LOG_LEVELS = [:debug, :info, :warn, :error, :fatal]
6
6
 
@@ -1,7 +1,27 @@
1
- gem 'amqp', '0.9.10'
1
+ gem 'amqp', '1.0.0'
2
2
 
3
3
  require 'amqp'
4
4
 
5
+ module AMQ
6
+ module Client
7
+ module Async
8
+ module Adapter
9
+ def send_heartbeat
10
+ if tcp_connection_established? && !reconnecting?
11
+ if !@handling_skipped_hearbeats && @last_server_heartbeat
12
+ send_frame(Protocol::HeartbeatFrame)
13
+ if @last_server_heartbeat < (Time.now - (self.heartbeat_interval * 2))
14
+ logger.error('detected missing amqp heartbeats')
15
+ self.handle_skipped_hearbeats
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
5
25
  module Sensu
6
26
  class RabbitMQError < StandardError; end
7
27
 
@@ -36,12 +56,14 @@ module Sensu
36
56
  :on_possible_authentication_failure => on_failure
37
57
  })
38
58
  @connection.logger = Logger.get
39
- @connection.on_tcp_connection_loss do |connection, settings|
40
- unless connection.reconnecting?
59
+ reconnect = Proc.new do
60
+ unless @connection.reconnecting?
41
61
  @before_reconnect.call
42
- connection.periodically_reconnect(5)
62
+ @connection.periodically_reconnect(5)
43
63
  end
44
64
  end
65
+ @connection.on_tcp_connection_loss(&reconnect)
66
+ @connection.on_skipped_heartbeats(&reconnect)
45
67
  @channel = AMQP::Channel.new(@connection)
46
68
  @channel.auto_recovery = true
47
69
  @channel.on_error do |channel, channel_close|
@@ -90,7 +90,7 @@ module Sensu
90
90
  changes = deep_diff(@settings, merged)
91
91
  @logger.warn('config file applied changes', {
92
92
  :config_file => file,
93
- :changes => redact_passwords(changes)
93
+ :changes => redact_sensitive(changes)
94
94
  })
95
95
  end
96
96
  @settings = merged
@@ -429,6 +429,16 @@ module Sensu
429
429
  end
430
430
  end
431
431
  end
432
+ if @settings[:client].has_key?(:redact)
433
+ unless @settings[:client][:redact].is_a?(Array)
434
+ invalid('client redact must be an array')
435
+ end
436
+ @settings[:client][:redact].each do |key|
437
+ unless key.is_a?(String) && !key.empty?
438
+ invalid('client redact keys must each be a string')
439
+ end
440
+ end
441
+ end
432
442
  end
433
443
 
434
444
  def validate_api
@@ -58,13 +58,19 @@ module Sensu
58
58
  end
59
59
  end
60
60
 
61
- def redact_passwords(hash)
61
+ def redact_sensitive(hash, keys=nil)
62
+ keys ||= %w[
63
+ password passwd pass
64
+ api_key api_token
65
+ access_key secret_key private_key
66
+ secret
67
+ ]
62
68
  hash = hash.dup
63
69
  hash.each do |key, value|
64
- if %w[password passwd pass].include?(key.to_s)
70
+ if keys.include?(key.to_s)
65
71
  hash[key] = "REDACTED"
66
72
  elsif value.is_a?(Hash)
67
- hash[key] = redact_passwords(value)
73
+ hash[key] = redact_sensitive(value, keys)
68
74
  end
69
75
  end
70
76
  hash
data/sensu.gemspec CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.license = 'MIT'
14
14
  s.has_rdoc = false
15
15
 
16
- s.add_dependency('oj', '2.0.9')
16
+ s.add_dependency('oj', '2.1.4')
17
17
  s.add_dependency('eventmachine', '1.0.3')
18
- s.add_dependency('amqp', '0.9.10')
18
+ s.add_dependency('amqp', '1.0.0')
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('sinatra', '1.3.5')
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1487621072
4
+ hash: -2637871616
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
9
  - 0
10
10
  - beta
11
- version: 0.11.0.beta
11
+ - 1
12
+ version: 0.11.0.beta.1
12
13
  platform: ruby
13
14
  authors:
14
15
  - Sean Porter
@@ -17,27 +18,29 @@ autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2013-08-14 00:00:00 -07:00
21
+ date: 2013-08-28 00:00:00 -07:00
21
22
  default_executable:
22
23
  dependencies:
23
24
  - !ruby/object:Gem::Dependency
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ name: oj
26
+ prerelease: false
27
+ requirement: &id001 !ruby/object:Gem::Requirement
25
28
  none: false
26
29
  requirements:
27
30
  - - "="
28
31
  - !ruby/object:Gem::Version
29
- hash: 29
32
+ hash: 3
30
33
  segments:
31
34
  - 2
32
- - 0
33
- - 9
34
- version: 2.0.9
35
- requirement: *id001
35
+ - 1
36
+ - 4
37
+ version: 2.1.4
36
38
  type: :runtime
37
- name: oj
38
- prerelease: false
39
+ version_requirements: *id001
39
40
  - !ruby/object:Gem::Dependency
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ name: eventmachine
42
+ prerelease: false
43
+ requirement: &id002 !ruby/object:Gem::Requirement
41
44
  none: false
42
45
  requirements:
43
46
  - - "="
@@ -48,28 +51,28 @@ dependencies:
48
51
  - 0
49
52
  - 3
50
53
  version: 1.0.3
51
- requirement: *id002
52
54
  type: :runtime
53
- name: eventmachine
54
- prerelease: false
55
+ version_requirements: *id002
55
56
  - !ruby/object:Gem::Dependency
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ name: amqp
58
+ prerelease: false
59
+ requirement: &id003 !ruby/object:Gem::Requirement
57
60
  none: false
58
61
  requirements:
59
62
  - - "="
60
63
  - !ruby/object:Gem::Version
61
- hash: 47
64
+ hash: 23
62
65
  segments:
66
+ - 1
67
+ - 0
63
68
  - 0
64
- - 9
65
- - 10
66
- version: 0.9.10
67
- requirement: *id003
69
+ version: 1.0.0
68
70
  type: :runtime
69
- name: amqp
70
- prerelease: false
71
+ version_requirements: *id003
71
72
  - !ruby/object:Gem::Dependency
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
73
+ name: em-redis-unified
74
+ prerelease: false
75
+ requirement: &id004 !ruby/object:Gem::Requirement
73
76
  none: false
74
77
  requirements:
75
78
  - - "="
@@ -80,12 +83,12 @@ dependencies:
80
83
  - 4
81
84
  - 1
82
85
  version: 0.4.1
83
- requirement: *id004
84
86
  type: :runtime
85
- name: em-redis-unified
86
- prerelease: false
87
+ version_requirements: *id004
87
88
  - !ruby/object:Gem::Dependency
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
89
+ name: thin
90
+ prerelease: false
91
+ requirement: &id005 !ruby/object:Gem::Requirement
89
92
  none: false
90
93
  requirements:
91
94
  - - "="
@@ -96,12 +99,12 @@ dependencies:
96
99
  - 5
97
100
  - 0
98
101
  version: 1.5.0
99
- requirement: *id005
100
102
  type: :runtime
101
- name: thin
102
- prerelease: false
103
+ version_requirements: *id005
103
104
  - !ruby/object:Gem::Dependency
104
- version_requirements: &id006 !ruby/object:Gem::Requirement
105
+ name: sinatra
106
+ prerelease: false
107
+ requirement: &id006 !ruby/object:Gem::Requirement
105
108
  none: false
106
109
  requirements:
107
110
  - - "="
@@ -112,12 +115,12 @@ dependencies:
112
115
  - 3
113
116
  - 5
114
117
  version: 1.3.5
115
- requirement: *id006
116
118
  type: :runtime
117
- name: sinatra
118
- prerelease: false
119
+ version_requirements: *id006
119
120
  - !ruby/object:Gem::Dependency
120
- version_requirements: &id007 !ruby/object:Gem::Requirement
121
+ name: async_sinatra
122
+ prerelease: false
123
+ requirement: &id007 !ruby/object:Gem::Requirement
121
124
  none: false
122
125
  requirements:
123
126
  - - "="
@@ -128,12 +131,12 @@ dependencies:
128
131
  - 0
129
132
  - 0
130
133
  version: 1.0.0
131
- requirement: *id007
132
134
  type: :runtime
133
- name: async_sinatra
134
- prerelease: false
135
+ version_requirements: *id007
135
136
  - !ruby/object:Gem::Dependency
136
- version_requirements: &id008 !ruby/object:Gem::Requirement
137
+ name: rake
138
+ prerelease: false
139
+ requirement: &id008 !ruby/object:Gem::Requirement
137
140
  none: false
138
141
  requirements:
139
142
  - - ">="
@@ -142,12 +145,12 @@ dependencies:
142
145
  segments:
143
146
  - 0
144
147
  version: "0"
145
- requirement: *id008
146
148
  type: :development
147
- name: rake
148
- prerelease: false
149
+ version_requirements: *id008
149
150
  - !ruby/object:Gem::Dependency
150
- version_requirements: &id009 !ruby/object:Gem::Requirement
151
+ name: rspec
152
+ prerelease: false
153
+ requirement: &id009 !ruby/object:Gem::Requirement
151
154
  none: false
152
155
  requirements:
153
156
  - - ">="
@@ -156,12 +159,12 @@ dependencies:
156
159
  segments:
157
160
  - 0
158
161
  version: "0"
159
- requirement: *id009
160
162
  type: :development
161
- name: rspec
162
- prerelease: false
163
+ version_requirements: *id009
163
164
  - !ruby/object:Gem::Dependency
164
- version_requirements: &id010 !ruby/object:Gem::Requirement
165
+ name: em-http-request
166
+ prerelease: false
167
+ requirement: &id010 !ruby/object:Gem::Requirement
165
168
  none: false
166
169
  requirements:
167
170
  - - ">="
@@ -170,10 +173,8 @@ dependencies:
170
173
  segments:
171
174
  - 0
172
175
  version: "0"
173
- requirement: *id010
174
176
  type: :development
175
- name: em-http-request
176
- prerelease: false
177
+ version_requirements: *id010
177
178
  description: A monitoring framework that aims to be simple, malleable, and scalable. Uses the publish/subscribe model.
178
179
  email:
179
180
  - portertech@gmail.com