sensu 0.9.13 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## 0.10.0 - 2013-06-27
2
+
3
+ ### Non-backwards compatible changes
4
+
5
+ Client & check names must not contain spaces or special characters.
6
+ The valid characters are: a-z, A-Z, 0-9, "_", ".", and "-".
7
+
8
+ "command_executed" was removed from check results, as it may contain
9
+ sensitive information, such as credentials.
10
+
11
+ ### Feature
12
+
13
+ Passwords in client data (keepalives) and log events are replaced with
14
+ "REDACTED", reducing the possibility of exposure. The following
15
+ attributes will have their values replaced: "password", "passwd", and
16
+ "pass".
17
+
18
+ ### Other
19
+
20
+ Fixed nil check status when check does not exit.
21
+
22
+ Fixed the built-in debug handler output encoding (JSON).
23
+
1
24
  ## 0.9.13 - 2013-05-20
2
25
 
3
26
  ### Features
data/README.md CHANGED
@@ -5,7 +5,7 @@ A monitoring framework that aims to be simple, malleable, and scalable.
5
5
  [![Build Status](https://secure.travis-ci.org/sensu/sensu.png)](https://travis-ci.org/sensu/sensu)
6
6
 
7
7
  ## Documentation
8
- Please refer to the [Sensu Wiki](https://github.com/sensu/sensu/wiki).
8
+ Please refer to the [Sensu Docs](http://docs.sensuapp.org/).
9
9
 
10
10
  ## License
11
11
  Sensu is released under the [MIT license](https://raw.github.com/sensu/sensu/master/MIT-LICENSE.txt).
data/lib/sensu/client.rb CHANGED
@@ -47,7 +47,8 @@ module Sensu
47
47
  end
48
48
 
49
49
  def publish_keepalive
50
- payload = @settings[:client].merge(:timestamp => Time.now.to_i)
50
+ keepalive = @settings[:client].merge(:timestamp => Time.now.to_i)
51
+ payload = redact_passwords(keepalive)
51
52
  @logger.debug('publishing keepalive', {
52
53
  :payload => payload
53
54
  })
@@ -103,7 +104,6 @@ module Sensu
103
104
  command, unmatched_tokens = substitute_command_tokens(check)
104
105
  check[:executed] = Time.now.to_i
105
106
  if unmatched_tokens.empty?
106
- check[:command_executed] = command
107
107
  execute = Proc.new do
108
108
  @logger.debug('executing check command', {
109
109
  :check => check
@@ -189,18 +189,11 @@ module Sensu
189
189
  queue.bind(@amq.fanout(exchange_name))
190
190
  end
191
191
  queue.subscribe do |payload|
192
- begin
193
- check = Oj.load(payload)
194
- @logger.info('received check request', {
195
- :check => check
196
- })
197
- process_check(check)
198
- rescue Oj::ParseError => error
199
- @logger.warn('check request payload must be valid json', {
200
- :payload => payload,
201
- :error => error.to_s
202
- })
203
- end
192
+ check = Oj.load(payload)
193
+ @logger.info('received check request', {
194
+ :check => check
195
+ })
196
+ process_check(check)
204
197
  end
205
198
  end
206
199
  end
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.9.13'
3
+ VERSION = '0.10.0'
4
4
 
5
5
  LOG_LEVELS = [:debug, :info, :warn, :error, :fatal]
6
6
 
@@ -10,7 +10,7 @@ module Sensu
10
10
  end
11
11
 
12
12
  def run(event, settings, &block)
13
- block.call(Oj.dump(event), 0)
13
+ block.call(event, 0)
14
14
  end
15
15
  end
16
16
  end
data/lib/sensu/io.rb CHANGED
@@ -68,7 +68,7 @@ module Sensu
68
68
  if wait_on_group
69
69
  wait_on_process_group(process.pid)
70
70
  end
71
- [output, status.exitstatus]
71
+ [output, status.exited? ? status.exitstatus : 2]
72
72
  end
73
73
  end
74
74
  end
data/lib/sensu/server.rb CHANGED
@@ -282,6 +282,7 @@ module Sensu
282
282
  :mutator => mutator,
283
283
  :error => error.to_s
284
284
  })
285
+ @handlers_in_progress_count -= 1
285
286
  end
286
287
  execute_command(mutator[:command], Oj.dump(event), on_error) do |output, status|
287
288
  if status == 0
@@ -298,15 +299,17 @@ module Sensu
298
299
  else
299
300
  @logger.error('mutator error', {
300
301
  :event => event,
301
- :extension => extension,
302
+ :extension => extension.definition,
302
303
  :error => 'non-zero exit status (' + status.to_s + '): ' + output
303
304
  })
305
+ @handlers_in_progress_count -= 1
304
306
  end
305
307
  end
306
308
  else
307
309
  @logger.error('unknown mutator', {
308
310
  :mutator_name => mutator_name
309
311
  })
312
+ @handlers_in_progress_count -= 1
310
313
  end
311
314
  end
312
315
 
@@ -502,19 +505,6 @@ module Sensu
502
505
  end
503
506
  end
504
507
 
505
- def valid_result?(result)
506
- if result[:client].is_a?(String) && result[:check].is_a?(Hash)
507
- result[:check][:name].is_a?(String) &&
508
- result[:check][:output].is_a?(String) &&
509
- result[:check][:status].is_a?(Integer)
510
- else
511
- @logger.warn('invalid result', {
512
- :result => result
513
- })
514
- false
515
- end
516
- end
517
-
518
508
  def setup_results
519
509
  @logger.debug('subscribing to results')
520
510
  @result_queue = @amq.queue!('results')
@@ -524,9 +514,7 @@ module Sensu
524
514
  @logger.debug('received result', {
525
515
  :result => result
526
516
  })
527
- if valid_result?(result)
528
- process_result(result)
529
- end
517
+ process_result(result)
530
518
  EM::next_tick do
531
519
  header.ack
532
520
  end
@@ -87,9 +87,10 @@ module Sensu
87
87
  config = Oj.load(contents)
88
88
  merged = deep_merge(@settings, config)
89
89
  unless @loaded_files.empty?
90
+ changes = deep_diff(@settings, merged)
90
91
  @logger.warn('config file applied changes', {
91
92
  :config_file => file,
92
- :changes => deep_diff(@settings, merged)
93
+ :changes => redact_passwords(changes)
93
94
  })
94
95
  end
95
96
  @settings = merged
@@ -210,7 +211,7 @@ module Sensu
210
211
  end
211
212
 
212
213
  def validate_check(check)
213
- unless check[:name] =~ /^[\w-]+$/
214
+ unless check[:name] =~ /^[\w\.-]+$/
214
215
  invalid_check(check, 'check name cannot contain spaces or special characters')
215
216
  end
216
217
  unless (check[:interval].is_a?(Integer) && check[:interval] > 0) || !check[:publish]
@@ -379,8 +380,8 @@ module Sensu
379
380
  unless @settings[:client].is_a?(Hash)
380
381
  invalid('missing client configuration')
381
382
  end
382
- unless @settings[:client][:name].is_a?(String) && !@settings[:client][:name].empty?
383
- invalid('client must have a name')
383
+ unless @settings[:client][:name] =~ /^[\w\.-]+$/
384
+ invalid('client must have a name and it cannot contain spaces or special characters')
384
385
  end
385
386
  unless @settings[:client][:address].is_a?(String)
386
387
  invalid('client must have an address')
@@ -57,5 +57,16 @@ module Sensu
57
57
  diff
58
58
  end
59
59
  end
60
+
61
+ def redact_passwords(hash)
62
+ hash.each do |key, value|
63
+ if %w[password passwd pass].include?(key.to_s)
64
+ hash[key] = "REDACTED"
65
+ elsif value.is_a?(Hash)
66
+ hash[key] = redact_passwords(value)
67
+ end
68
+ end
69
+ hash
70
+ end
60
71
  end
61
72
  end
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: 33
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 9
9
- - 13
10
- version: 0.9.13
8
+ - 10
9
+ - 0
10
+ version: 0.10.0
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-05-20 00:00:00 -07:00
19
+ date: 2013-06-27 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency