sensu 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d92df9cfdb9c845a0c5bb841f2f3bfb459f0d81
4
- data.tar.gz: 3caaa8d79d44cc3ea6868cef24fcc52fc980dcfb
3
+ metadata.gz: abc95454535a1de5457e625a992d6d4de138bc9c
4
+ data.tar.gz: cdb41cd96c00967d8c7653edb03b4dddc23f5800
5
5
  SHA512:
6
- metadata.gz: 9f90edb5abefe6f6dabed9c4da2c4b54e4cd30345f34fcb01c0c5b9715c8ee1325a431cec7c29d0caf5dbc2ad012bfa59d363cf295807b076504294143846cd7
7
- data.tar.gz: ad5cf09094b96df12fba2d621586d90ccc437306377887a307283bf025bc3c19eec96a1c2d30bc3cf0ab69fd0aac842872596f9cc55fcc57f11ff35fb4e09124
6
+ metadata.gz: e211d7fc0dc37af916333af52a926d1fa41d5be94d5472ec1deb8dfb2edcb775a5246ca3ea32df21de7c41fb3a811549f5cb13f8bf444b3800cd02564d33295f
7
+ data.tar.gz: 8d6790cbca39aec06b05e3a1874eae7a15d580e079d7a5b8edc1ab94bf8a85e21a402c09a1e51dd2bd9692558b2eee3c5e859543bfdb51e467c556fd1a701b56
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- 0���s���~��G ^ܒ�sj�ۿ�_4t{I3Qk09���t�+2(�2�V� _JZ��\��^ "/���n���"I��$��6���s���V�_h���8K@�FE��A�ت�4�G�`�c7��'0H��e3�Vi0*2�~�3k��fs����{���N��۹gIenj�|�$��q\������IY� :�l,�N���#���):~�.��.����r9E��ڨM0;Lr3���R?�
1
+ �W�T��F��󷅃�P����E)��tLթ�A���\c��)<|w�|�M�z�9ݾ������Wϰ�-����)&�%]�aD����a��N�hϱ�Q�W��.�������h+/�m{���L��-}����qs.�'7�^PS��/�83�4��_���\d?}ԫrJ����_��P���TY1����^�w�3�L���,`V��$����5HE���l���e7��b�<N�a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.7.0] - 2018-02-19
9
+
10
+ ### Added
11
+ - Added a response body to the api health endpoint including transport consumer & message counts.
12
+ - Bump sensu-extensions to 1.11.0 to add support for built-in sensu-extensions-deregistration handler.
13
+ - Added an eventmachine globbal catch-all error handler.
14
+
15
+ ### Fixed
16
+ - Token substitution will now only split on the first instance of the pipe character.
17
+ - Use `deep_dup` in api token substitution to prevent an issue where substitution could use an incorrect value.
18
+ - Redacted attributes are now redacted from the `/clients` and `/clients/:client` routes.
19
+ - Server registry entires that fail to expire are now cleaned up.
20
+ - Improved error logging.
21
+
8
22
  ## [1.6.2] - 2018-12-07
9
23
 
10
24
  ### Fixed
@@ -42,7 +42,8 @@ module Sensu
42
42
  clients.each_with_index do |client_name, index|
43
43
  @redis.get("client:#{client_name}") do |client_json|
44
44
  unless client_json.nil?
45
- @response_content << Sensu::JSON.load(client_json)
45
+ client = Sensu::JSON.load(client_json)
46
+ @response_content << redact_sensitive(client, client[:redact])
46
47
  else
47
48
  @logger.error("client data missing from registry", :client_name => client_name)
48
49
  @redis.srem("clients", client_name)
@@ -63,7 +64,8 @@ module Sensu
63
64
  client_name = parse_uri(CLIENT_URI).first
64
65
  @redis.get("client:#{client_name}") do |client_json|
65
66
  unless client_json.nil?
66
- @response_content = Sensu::JSON.load(client_json)
67
+ client = Sensu::JSON.load(client_json)
68
+ @response_content = redact_sensitive(client, client[:redact])
67
69
  respond
68
70
  else
69
71
  not_found!
@@ -10,22 +10,32 @@ module Sensu
10
10
 
11
11
  # GET /health
12
12
  def get_health
13
+ @response_content = []
13
14
  if @redis.connected? && @transport.connected?
14
- healthy = []
15
15
  min_consumers = integer_parameter(@params[:consumers])
16
16
  max_messages = integer_parameter(@params[:messages])
17
17
  transport_info do |info|
18
18
  if min_consumers
19
- healthy << (info[:keepalives][:consumers] >= min_consumers)
20
- healthy << (info[:results][:consumers] >= min_consumers)
19
+ if info[:keepalives][:consumers] < min_consumers
20
+ @response_content << "keepalive consumers (#{info[:keepalives][:consumers]}) less than min_consumers (#{min_consumers})"
21
+ end
22
+ if info[:results][:consumers] < min_consumers
23
+ @response_content << "result consumers (#{info[:results][:consumers]}) less than min_consumers (#{min_consumers})"
24
+ end
21
25
  end
22
26
  if max_messages
23
- healthy << (info[:keepalives][:messages] <= max_messages)
24
- healthy << (info[:results][:messages] <= max_messages)
27
+ if info[:keepalives][:messages] > max_messages
28
+ @response_content << "keepalive messages (#{info[:keepalives][:messages]}) greater than max_messages (#{max_messages})"
29
+ end
30
+ if info[:results][:messages] > max_messages
31
+ @response_content << "result messages (#{info[:results][:messages]}) greater than max_messages (#{max_messages})"
32
+ end
25
33
  end
26
- healthy.all? ? no_content! : precondition_failed!
34
+ @response_content.empty? ? no_content! : precondition_failed!
27
35
  end
28
36
  else
37
+ @response_content << "not connected to redis" unless @redis.connected?
38
+ @response_content << "not connected to transport" unless @transport.connected?
29
39
  precondition_failed!
30
40
  end
31
41
  end
@@ -82,7 +82,7 @@ module Sensu
82
82
  :client => client,
83
83
  :check => check
84
84
  })
85
- proxy_check, unmatched_tokens = object_substitute_tokens(check.dup, client)
85
+ proxy_check, unmatched_tokens = object_substitute_tokens(deep_dup(check.dup), client)
86
86
  if unmatched_tokens.empty?
87
87
  proxy_check[:source] ||= client[:name]
88
88
  publish_check_request(proxy_check)
@@ -13,7 +13,14 @@ module Sensu
13
13
  servers.each_with_index do |server_id, index|
14
14
  @redis.get("server:#{server_id}") do |server_json|
15
15
  unless server_json.nil?
16
- info << Sensu::JSON.load(server_json)
16
+ server = Sensu::JSON.load(server_json)
17
+ if server[:timestamp] >= (Time.now.to_i - 30)
18
+ info << server
19
+ else
20
+ @redis.del("server:#{server_id}") do
21
+ @redis.srem("servers", server_id)
22
+ end
23
+ end
17
24
  else
18
25
  @redis.srem("servers", server_id)
19
26
  end
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "1.6.2".freeze
4
+ VERSION = "1.7.0".freeze
5
5
 
6
6
  # Sensu release information.
7
7
  RELEASE_INFO = {
data/lib/sensu/daemon.rb CHANGED
@@ -4,9 +4,9 @@ gem "eventmachine", "1.2.7"
4
4
 
5
5
  gem "sensu-json", "2.1.1"
6
6
  gem "sensu-logger", "1.2.2"
7
- gem "sensu-settings", "10.14.0"
7
+ gem "sensu-settings", "10.15.0"
8
8
  gem "sensu-extension", "1.5.2"
9
- gem "sensu-extensions", "1.10.0"
9
+ gem "sensu-extensions", "1.11.0"
10
10
  gem "sensu-transport", "8.2.0"
11
11
  gem "sensu-spawn", "2.5.0"
12
12
  gem "sensu-redis", "2.4.0"
@@ -51,6 +51,9 @@ module Sensu
51
51
  unless EM::reactor_running?
52
52
  EM::epoll
53
53
  EM::set_max_timers(200000)
54
+ EM::error_handler do |error|
55
+ unexpected_error(error)
56
+ end
54
57
  end
55
58
  setup_logger(options)
56
59
  load_settings(options)
@@ -61,6 +64,33 @@ module Sensu
61
64
  setup_process(options)
62
65
  end
63
66
 
67
+ # Handle an unexpected error. This method is used for EM global
68
+ # catch-all error handling, accepting an error object. Error
69
+ # handling is opt-in via a configuration option, e.g. `"sensu":
70
+ # {"global_error_handler": true}`. If a user does not opt-in, the
71
+ # provided error will be raised (uncaught). If a user opts-in via
72
+ # configuration, the error will be logged and ignored :itsfine:.
73
+ #
74
+ # @param error [Object]
75
+ def unexpected_error(error)
76
+ if @settings && @settings[:sensu][:global_error_handler]
77
+ backtrace = error.backtrace.join("\n")
78
+ if @logger
79
+ @logger.warn("global catch-all error handling enabled")
80
+ @logger.fatal("unexpected error - please address this immediately", {
81
+ :error => error.to_s,
82
+ :error_class => error.class,
83
+ :backtrace => backtrace
84
+ })
85
+ else
86
+ puts "global catch-all error handling enabled"
87
+ puts "unexpected error - please address this immediately: #{error.to_s}\n#{error.class}\n#{backtrace}"
88
+ end
89
+ else
90
+ raise error
91
+ end
92
+ end
93
+
64
94
  # Set up the Sensu logger and its process signal traps for log
65
95
  # rotation and debug log level toggling. This method creates the
66
96
  # logger instance variable: `@logger`.
@@ -190,7 +190,7 @@ module Sensu
190
190
  :replace => ""
191
191
  })
192
192
  substituted = encoded_tokens.gsub(/:::([^:].*?):::/) do
193
- token, default = $1.to_s.split("|", -1)
193
+ token, default = $1.to_s.split("|", 2)
194
194
  path = token.split(".").map(&:to_sym)
195
195
  matched = find_attribute_value(attributes, path, default)
196
196
  if matched.nil?
data/sensu.gemspec CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
  s.add_dependency "eventmachine", "1.2.7"
15
15
  s.add_dependency "sensu-json", "2.1.1"
16
16
  s.add_dependency "sensu-logger", "1.2.2"
17
- s.add_dependency "sensu-settings", "10.14.0"
17
+ s.add_dependency "sensu-settings", "10.15.0"
18
18
  s.add_dependency "sensu-extension", "1.5.2"
19
- s.add_dependency "sensu-extensions", "1.10.0"
19
+ s.add_dependency "sensu-extensions", "1.11.0"
20
20
  s.add_dependency "sensu-transport", "8.2.0"
21
21
  s.add_dependency "sensu-spawn", "2.5.0"
22
22
  s.add_dependency "sensu-redis", "2.4.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -31,7 +31,7 @@ cert_chain:
31
31
  jOeGyhtQa9j4FFmsEJDg59f5v/3hECXsa3Xuml3foaFHzX3Ya/YIyd2YFxvkFKIu
32
32
  GVbe7A3YdxzdkH2Es/Ym9twdxXaIDdXzj8sWhw==
33
33
  -----END CERTIFICATE-----
34
- date: 2018-12-07 00:00:00.000000000 Z
34
+ date: 2019-02-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: eventmachine
@@ -81,14 +81,14 @@ dependencies:
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 10.14.0
84
+ version: 10.15.0
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 10.14.0
91
+ version: 10.15.0
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: sensu-extension
94
94
  requirement: !ruby/object:Gem::Requirement
@@ -109,14 +109,14 @@ dependencies:
109
109
  requirements:
110
110
  - - '='
111
111
  - !ruby/object:Gem::Version
112
- version: 1.10.0
112
+ version: 1.11.0
113
113
  type: :runtime
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 1.10.0
119
+ version: 1.11.0
120
120
  - !ruby/object:Gem::Dependency
121
121
  name: sensu-transport
122
122
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file