sensu 0.27.0 → 0.27.1

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: 7f4831b939bf3b0839d0a4a845fc6320da96e0cd
4
- data.tar.gz: 87752deeb5355081b21c97a50ac6a22f219aaa9b
3
+ metadata.gz: 848a4443459327c245760df5a5845eb525c0f764
4
+ data.tar.gz: 747c00aa13b824942c83c1d9970ffdc2d922aae3
5
5
  SHA512:
6
- metadata.gz: 1359a4962efd532af46b7596e2f04bc067ef82cd80a99ce145cc75a7129f469d683051d58ee0591b1d37b294762648e97c0f87aa519a2525f34bbcf930baa4af
7
- data.tar.gz: c75815d4ee1a51ddb04edf182cfa916b101b0592d004528e869fc1a189e40bf9d32683d830263664e43878c5b0a228d8ec9c1a31959f39c89846c4b287401b81
6
+ metadata.gz: 15d626cff0c140b0cad61db37d810c7d4a535c85e938c73b0e12baf31c01bb7850246867c5886e63099308f776754962f6ba03843a6aae19c8580197dc1e4c96
7
+ data.tar.gz: da0a760f6bb3ebf0ba1832387e6ff2ea84202692f10dab35e03ce06fbdcddf31bd8a8e5230b22b93f9b002303f5b16589f8a3de5ed5aa85050ed5bb01cccb70c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.27.1 - 2017-02-17
2
+
3
+ ### Other
4
+
5
+ Failed pipe handler executions are now logged with the error log level.
6
+
7
+ Sensu server now adds a unique per-client subscription to client
8
+ keepalives when missing. This is to enable built-in event silencing for
9
+ older Sensu clients (< 0.26).
10
+
11
+ ### Fixes
12
+
13
+ Check subdue and filter when time windows now account for GMT offsets.
14
+
15
+ Non UTF-8 characters in check tokens are now removed.
16
+
17
+ Fixed filter name logging when an event is filtered.
18
+
1
19
  ## 0.27.0 - 2017-01-26
2
20
 
3
21
  ### Features
data/README.md CHANGED
@@ -1,11 +1,52 @@
1
1
  ![sensu](https://raw.github.com/sensu/sensu/master/sensu-logo.png)
2
2
 
3
- A monitoring framework that aims to be simple, malleable, and scalable.
3
+ [![Build Status](https://img.shields.io/travis/sensu/sensu.png)](https://travis-ci.org/sensu/sensu)
4
+ [![Gem Version](https://img.shields.io/gem/v/sensu.svg)](https://github.com/sensu/sensu/blob/master/CHANGELOG.md)
5
+ ![MIT Licensed](https://img.shields.io/github/license/sensu/sensu.svg)
4
6
 
5
- [![Build Status](https://secure.travis-ci.org/sensu/sensu.png)](https://travis-ci.org/sensu/sensu)
7
+ # Sensu
8
+
9
+ A simple, malleable, and scalable framework for composing
10
+ the monitoring system you need.
11
+
12
+ Sensu is offered in two flavors:
13
+
14
+ * Sensu Core - this open source project
15
+ * [Sensu Enterprise][1] - a full-featured commercial implementation, built on Sensu Core
16
+
17
+ ## Installation
18
+
19
+ Sensu supports a number of Unix-like platforms, as well as Windows.
20
+ Please see the [list of supported platforms][2] for installation instructions.
6
21
 
7
22
  ## Documentation
8
- Please refer to the [Sensu Docs](http://sensuapp.org/docs/latest/overview).
23
+
24
+ Please refer to the [online documentation][3] for details
25
+ on configuring and operating Sensu.
26
+
27
+ ## Getting Help
28
+
29
+ If you have questions not covered by the documentation, the Sensu community
30
+ is here to help. Please check out our [chat][4] on Freenode IRC, or the
31
+ [sensu-users][5] discussion list.
32
+
33
+ Commercial support is also available. See the [support section of our website][6] for more detail.
34
+
35
+ ## Contributing
36
+
37
+ Please observe these [guidelines on contributing][7].
38
+
9
39
 
10
40
  ## License
11
- Sensu is released under the [MIT license](https://raw.github.com/sensu/sensu/master/MIT-LICENSE.txt).
41
+
42
+ Sensu Core is released under the [MIT license][8].
43
+
44
+
45
+ [1]: https://sensuapp.org/enterprise
46
+ [2]: https://sensuapp.org/docs/latest/platforms/
47
+ [3]: http://sensuapp.org/docs/latest/overview
48
+ [4]: http://webchat.freenode.net/?channels=%23sensu
49
+ [5]: http://groups.google.com/group/sensu-users
50
+ [6]: https://sensuapp.org/support
51
+ [7]: https://github.com/sensu/sensu/blob/master/CONTRIBUTING.md
52
+ [8]: https://raw.github.com/sensu/sensu/master/MIT-LICENSE.txt
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "0.27.0".freeze
4
+ VERSION = "0.27.1".freeze
5
5
 
6
6
  # Sensu check severities.
7
7
  SEVERITIES = %w[ok warning critical unknown].freeze
data/lib/sensu/daemon.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "rubygems"
2
2
 
3
- gem "eventmachine", "1.2.1"
3
+ gem "eventmachine", "1.2.2"
4
4
 
5
5
  gem "sensu-json", "2.0.1"
6
6
  gem "sensu-logger", "1.2.1"
7
- gem "sensu-settings", "9.6.0"
7
+ gem "sensu-settings", "9.8.0"
8
8
  gem "sensu-extension", "1.5.1"
9
9
  gem "sensu-extensions", "1.7.1"
10
10
  gem "sensu-transport", "7.0.2"
@@ -48,7 +48,10 @@ module Sensu
48
48
  @start_time = Time.now.to_i
49
49
  @state = :initializing
50
50
  @timers = {:run => []}
51
- EM::set_max_timers(200000) unless EM::reactor_running?
51
+ unless EM::reactor_running?
52
+ EM::epoll
53
+ EM::set_max_timers(200000)
54
+ end
52
55
  setup_logger(options)
53
56
  load_settings(options)
54
57
  unless sensu_service_name == "api"
@@ -184,9 +187,11 @@ module Sensu
184
187
  end
185
188
 
186
189
  # Start the Sensu service and set the service state to `:running`.
187
- # This method will likely be overridden by a subclass.
190
+ # This method will likely be overridden by a subclass. Yield if a
191
+ # block is provided.
188
192
  def start
189
193
  @state = :running
194
+ yield if block_given?
190
195
  end
191
196
 
192
197
  # Pause the Sensu service and set the service state to `:paused`.
@@ -264,7 +264,7 @@ module Sensu
264
264
  yield(false)
265
265
  else
266
266
  event_filter(filter_name, event) do |filtered|
267
- filtered ? yield(true) : EM.next_tick { filter.call(filter_list) }
267
+ filtered ? yield(true, filter_name) : EM.next_tick { filter.call(filter_list) }
268
268
  end
269
269
  end
270
270
  end
@@ -26,13 +26,18 @@ module Sensu
26
26
  # `@in_progress[:events]` by `1` when the handler executes
27
27
  # successfully.
28
28
  #
29
+ # When the spawned process exits with status 0, its output is
30
+ # logged at :info level. Otherwise, its output is logged at
31
+ # :error level.
32
+ #
29
33
  # @param handler [Hash] definition.
30
34
  # @param event_data [Object] provided to the spawned handler
31
35
  # process via STDIN.
32
36
  def pipe_handler(handler, event_data)
33
37
  options = {:data => event_data, :timeout => handler[:timeout]}
34
38
  Spawn.process(handler[:command], options) do |output, status|
35
- @logger.info("handler output", {
39
+ log_level = status == 0 ? :info : :error
40
+ @logger.send(log_level, "handler output", {
36
41
  :handler => handler,
37
42
  :output => output.split("\n+")
38
43
  })
@@ -119,13 +119,19 @@ module Sensu
119
119
 
120
120
  # Update the Sensu client registry, stored in Redis. Sensu
121
121
  # client data is used to provide additional event context and
122
- # enable agent health monitoring. The client registry supports
123
- # client signatures, unique string identifiers used for
124
- # keepalive and result source verification. If a client has a
125
- # signature, all further registry updates for the client must
126
- # have the same signature. A client can begin to use a signature
127
- # if one was not previously configured. JSON serialization is
128
- # used for the stored client data.
122
+ # enable agent health monitoring.
123
+ #
124
+ # To enable silencing individual clients, per-client
125
+ # subscriptions (`client:$CLIENT_NAME`) are added to client
126
+ # subscriptions automatically.
127
+ #
128
+ # The client registry supports client signatures, unique string
129
+ # identifiers used for keepalive and result source
130
+ # verification. If a client has a signature, all further
131
+ # registry updates for the client must have the same
132
+ # signature. A client can begin to use a signature if one was
133
+ # not previously configured. JSON serialization is used for the
134
+ # stored client data.
129
135
  #
130
136
  # @param client [Hash]
131
137
  # @yield [success] passes success status to optional
@@ -136,6 +142,7 @@ module Sensu
136
142
  def update_client_registry(client)
137
143
  @logger.debug("updating client registry", :client => client)
138
144
  client_key = "client:#{client[:name]}"
145
+ client[:subscriptions] = (client[:subscriptions] + [client_key]).uniq
139
146
  signature_key = "#{client_key}:signature"
140
147
  @redis.setnx(signature_key, client[:signature]) do |created|
141
148
  process_client_registration(client) if created
@@ -1166,10 +1173,12 @@ module Sensu
1166
1173
  end
1167
1174
 
1168
1175
  # Start the Sensu server process, connecting to Redis, the
1169
- # Transport, and calling the `bootstrap()` method.
1176
+ # Transport, and calling the `bootstrap()` method. Yield if a
1177
+ # block is provided.
1170
1178
  def start
1171
1179
  setup_connections do
1172
1180
  bootstrap
1181
+ yield if block_given?
1173
1182
  end
1174
1183
  end
1175
1184
 
@@ -107,7 +107,12 @@ module Sensu
107
107
  # and an array of unmatched tokens.
108
108
  def substitute_tokens(tokens, attributes)
109
109
  unmatched_tokens = []
110
- substituted = tokens.gsub(/:::([^:].*?):::/) do
110
+ encoded_tokens = tokens.encode("UTF-8", "binary", {
111
+ :invalid => :replace,
112
+ :undef => :replace,
113
+ :replace => ""
114
+ })
115
+ substituted = encoded_tokens.gsub(/:::([^:].*?):::/) do
111
116
  token, default = $1.to_s.split("|", -1)
112
117
  path = token.split(".").map(&:to_sym)
113
118
  matched = find_attribute_value(attributes, path, default)
@@ -133,9 +138,11 @@ module Sensu
133
138
  end_time = Time.parse(condition[:end])
134
139
  if end_time < begin_time
135
140
  if Time.now < end_time
136
- begin_time = Time.parse("12:00:00 AM")
141
+ offset = begin_time.strftime("%:z")
142
+ begin_time = Time.new("12:00:00 AM #{offset}")
137
143
  else
138
- end_time = Time.parse("11:59:59 PM")
144
+ offset = end_time.strftime("%:z")
145
+ end_time = Time.new("11:59:59 PM #{offset}")
139
146
  end
140
147
  end
141
148
  Time.now >= begin_time && Time.now <= end_time
data/sensu.gemspec CHANGED
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.license = "MIT"
13
13
  s.has_rdoc = false
14
14
 
15
- s.add_dependency "eventmachine", "1.2.1"
15
+ s.add_dependency "eventmachine", "1.2.2"
16
16
  s.add_dependency "sensu-json", "2.0.1"
17
17
  s.add_dependency "sensu-logger", "1.2.1"
18
- s.add_dependency "sensu-settings", "9.6.0"
18
+ s.add_dependency "sensu-settings", "9.8.0"
19
19
  s.add_dependency "sensu-extension", "1.5.1"
20
20
  s.add_dependency "sensu-extensions", "1.7.1"
21
21
  s.add_dependency "sensu-transport", "7.0.2"
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: 0.27.0
4
+ version: 0.27.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-01-26 00:00:00.000000000 Z
12
+ date: 2017-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.2.1
20
+ version: 1.2.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.2.1
27
+ version: 1.2.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sensu-json
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 9.6.0
62
+ version: 9.8.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 9.6.0
69
+ version: 9.8.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sensu-extension
72
72
  requirement: !ruby/object:Gem::Requirement