sensu 0.26.5 → 0.27.0.alpha

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: bdb46ea98930b412a16b3b6a8fe28a1be80aaf7e
4
- data.tar.gz: eed3df0997bf545992189584dfb67a8b879160b9
3
+ metadata.gz: 889fe13d5be50c9cb7fb891ee70290c5da0815f5
4
+ data.tar.gz: ee86423e7b3d8837b869904dbb7ae050e58dce15
5
5
  SHA512:
6
- metadata.gz: 6fedf552bf9910550c52cf47f3902c9610aa0bbd29645eb96be00f48c49d2ccf3a9f823543bb851478872ede49dc83cc525c736cafb78e72b80eefb1a88e52ac
7
- data.tar.gz: 1ef5a2bdd720ba5371334f4c194dedecb2bc485c4081eb75e5afab31896c002f4f54853dbb1c79425e00fea4082854e836237b551a1ffe03974d13865079bae0
6
+ metadata.gz: ac0100bdec9cba408c27ef4bae7c2b511e5260aec4868881b0754a128a94871a029a3747bdee653a2a6d229ed32ca5e5c9a780b0fc140a3454ef29290d953b19
7
+ data.tar.gz: b84039c62794fa94cdcb2cc44beec273fa1d89fe8514ae8d289b698db7a1afd00ae0c9e22f2582290ee25dc0764a69e8604d653c521fa96523c3117430a325d7
@@ -1,4 +1,4 @@
1
- ## 0.26.4 - 2016-10-12
1
+ ## 0.26.5 - 2016-10-12
2
2
 
3
3
  ### Fixes
4
4
 
@@ -53,6 +53,7 @@ module Sensu
53
53
  [RESULTS_CLIENT_URI, :get_results_client],
54
54
  [RESULT_URI, :get_result],
55
55
  [SILENCED_URI, :get_silenced],
56
+ [SILENCED_ID_URI, :get_silenced_id],
56
57
  [SILENCED_SUBSCRIPTION_URI, :get_silenced_subscription],
57
58
  [SILENCED_CHECK_URI, :get_silenced_check]
58
59
  ]
@@ -3,6 +3,7 @@ module Sensu
3
3
  module Routes
4
4
  module Silenced
5
5
  SILENCED_URI = /^\/silenced$/
6
+ SILENCED_ID_URI = /^\/silenced\/ids\/([\w\.\-\*\:]+)$/
6
7
  SILENCED_SUBSCRIPTION_URI = /^\/silenced\/subscriptions\/([\w\.\-:]+)$/
7
8
  SILENCED_CHECK_URI = /^\/silenced\/checks\/([\w\.\-]+)$/
8
9
  SILENCED_CLEAR_URI = /^\/silenced\/clear$/
@@ -45,7 +46,7 @@ module Sensu
45
46
  # POST /silenced
46
47
  def post_silenced
47
48
  rules = {
48
- :subscription => {:type => String, :nil_ok => true},
49
+ :subscription => {:type => String, :nil_ok => true, :regex => /\A[\w\.\-\:]+\z/},
49
50
  :check => {:type => String, :nil_ok => true, :regex => /\A[\w\.-]+\z/},
50
51
  :expire => {:type => Integer, :nil_ok => true},
51
52
  :reason => {:type => String, :nil_ok => true},
@@ -109,6 +110,25 @@ module Sensu
109
110
  end
110
111
  end
111
112
 
113
+ # GET /silenced/ids/:id
114
+ def get_silenced_id
115
+ id = parse_uri(SILENCED_ID_URI).first
116
+ @redis.smembers("silenced") do |silenced_keys|
117
+ silenced_keys.select! do |key|
118
+ key =~ /#{id.gsub('*', '\*')}$/
119
+ end
120
+ silenced_keys = pagination(silenced_keys)
121
+ fetch_silenced(silenced_keys) do |silenced|
122
+ if silenced.empty?
123
+ not_found!
124
+ else
125
+ @response_content = silenced.last
126
+ respond
127
+ end
128
+ end
129
+ end
130
+ end
131
+
112
132
  # GET /silenced/checks/:check
113
133
  def get_silenced_check
114
134
  check_name = parse_uri(SILENCED_CHECK_URI).first
@@ -496,8 +496,11 @@ module Sensu
496
496
  # deregistration check result if configured to do so.
497
497
  def stop
498
498
  @logger.warn("stopping")
499
+ last_state = @state
499
500
  pause
500
- deregister if @settings[:client][:deregister] == true
501
+ if @settings[:client][:deregister] == true && last_state != :initializing
502
+ deregister
503
+ end
501
504
  @state = :stopping
502
505
  complete_checks_in_progress do
503
506
  close_sockets
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "0.26.5".freeze
4
+ VERSION = "0.27.0.alpha".freeze
5
5
 
6
6
  # Sensu check severities.
7
7
  SEVERITIES = %w[ok warning critical unknown].freeze
@@ -2,14 +2,14 @@ require "rubygems"
2
2
 
3
3
  gem "eventmachine", "1.2.0.1"
4
4
 
5
- gem "sensu-json", "2.0.0"
6
- gem "sensu-logger", "1.2.0"
7
- gem "sensu-settings", "9.2.1"
8
- gem "sensu-extension", "1.5.0"
9
- gem "sensu-extensions", "1.7.0"
10
- gem "sensu-transport", "6.0.0"
11
- gem "sensu-spawn", "2.2.0"
12
- gem "sensu-redis", "1.6.0"
5
+ gem "sensu-json", "2.0.1"
6
+ gem "sensu-logger", "1.2.1"
7
+ gem "sensu-settings", "9.2.2"
8
+ gem "sensu-extension", "1.5.1"
9
+ gem "sensu-extensions", "1.7.1"
10
+ gem "sensu-transport", "7.0.2"
11
+ gem "sensu-spawn", "2.2.1"
12
+ gem "sensu-redis", "2.0.0"
13
13
 
14
14
  require "time"
15
15
  require "uri"
@@ -286,6 +286,7 @@ module Sensu
286
286
  # connection object to the callback/block.
287
287
  def setup_redis
288
288
  @logger.debug("connecting to redis", :settings => @settings[:redis])
289
+ Redis.logger = @logger
289
290
  Redis.connect(@settings[:redis]) do |connection|
290
291
  @redis = connection
291
292
  @redis.on_error do |error|
@@ -180,13 +180,14 @@ module Sensu
180
180
  # parameter to indicate if the event was filtered.
181
181
  # @yieldparam filtered [TrueClass,FalseClass] indicating if the
182
182
  # event was filtered.
183
+ # @yieldparam filter_name [String] name of the filter being evaluated
183
184
  def native_filter(filter_name, event)
184
185
  filter = @settings[:filters][filter_name]
185
186
  if in_filter_time_windows?(filter)
186
187
  matched = filter_attributes_match?(event, filter[:attributes])
187
- yield(filter[:negate] ? matched : !matched)
188
+ yield(filter[:negate] ? matched : !matched, filter_name)
188
189
  else
189
- yield(false)
190
+ yield(false, filter_name)
190
191
  end
191
192
  end
192
193
 
@@ -198,14 +199,15 @@ module Sensu
198
199
  # parameter to indicate if the event was filtered.
199
200
  # @yieldparam filtered [TrueClass,FalseClass] indicating if the
200
201
  # event was filtered.
202
+ # @yieldparam filter_name [String] name of the filter being evaluated
201
203
  def extension_filter(filter_name, event)
202
204
  extension = @extensions[:filters][filter_name]
203
205
  if in_filter_time_windows?(extension.definition)
204
206
  extension.safe_run(event) do |output, status|
205
- yield(status == 0)
207
+ yield(status == 0, filter_name)
206
208
  end
207
209
  else
208
- yield(false)
210
+ yield(false, filter_name)
209
211
  end
210
212
  end
211
213
 
@@ -223,19 +225,20 @@ module Sensu
223
225
  # parameter to indicate if the event was filtered.
224
226
  # @yieldparam filtered [TrueClass,FalseClass] indicating if the
225
227
  # event was filtered.
228
+ # @yieldparam filter_name [String] name of the filter being evaluated
226
229
  def event_filter(filter_name, event)
227
230
  case
228
231
  when @settings.filter_exists?(filter_name)
229
232
  native_filter(filter_name, event) do |filtered|
230
- yield(filtered)
233
+ yield(filtered, filter_name)
231
234
  end
232
235
  when @extensions.filter_exists?(filter_name)
233
236
  extension_filter(filter_name, event) do |filtered|
234
- yield(filtered)
237
+ yield(filtered, filter_name)
235
238
  end
236
239
  else
237
240
  @logger.error("unknown filter", :filter_name => filter_name)
238
- yield(false)
241
+ yield(false, filter_name)
239
242
  end
240
243
  end
241
244
 
@@ -298,10 +301,11 @@ module Sensu
298
301
  @logger.info(filter_message, details)
299
302
  @in_progress[:events] -= 1 if @in_progress
300
303
  else
301
- event_filtered?(handler, event) do |filtered|
304
+ event_filtered?(handler, event) do |filtered, filter_name|
302
305
  unless filtered
303
306
  yield(event)
304
307
  else
308
+ details[:filter] = filter_name
305
309
  @logger.info("event was filtered", details)
306
310
  @in_progress[:events] -= 1 if @in_progress
307
311
  end
@@ -13,14 +13,14 @@ Gem::Specification.new do |s|
13
13
  s.has_rdoc = false
14
14
 
15
15
  s.add_dependency "eventmachine", "1.2.0.1"
16
- s.add_dependency "sensu-json", "2.0.0"
17
- s.add_dependency "sensu-logger", "1.2.0"
18
- s.add_dependency "sensu-settings", "9.2.1"
19
- s.add_dependency "sensu-extension", "1.5.0"
20
- s.add_dependency "sensu-extensions", "1.7.0"
21
- s.add_dependency "sensu-transport", "6.0.0"
22
- s.add_dependency "sensu-spawn", "2.2.0"
23
- s.add_dependency "sensu-redis", "1.6.0"
16
+ s.add_dependency "sensu-json", "2.0.1"
17
+ s.add_dependency "sensu-logger", "1.2.1"
18
+ s.add_dependency "sensu-settings", "9.2.2"
19
+ s.add_dependency "sensu-extension", "1.5.1"
20
+ s.add_dependency "sensu-extensions", "1.7.1"
21
+ s.add_dependency "sensu-transport", "7.0.2"
22
+ s.add_dependency "sensu-spawn", "2.2.1"
23
+ s.add_dependency "sensu-redis", "2.0.0"
24
24
  s.add_dependency "em-http-server", "0.1.8"
25
25
 
26
26
  s.add_development_dependency "rake", "10.5.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: 0.26.5
4
+ version: 0.27.0.alpha
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: 2016-10-12 00:00:00.000000000 Z
12
+ date: 2016-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -31,112 +31,112 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0
34
+ version: 2.0.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 2.0.0
41
+ version: 2.0.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sensu-logger
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.2.0
48
+ version: 1.2.1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.2.0
55
+ version: 1.2.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: sensu-settings
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 9.2.1
62
+ version: 9.2.2
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.2.1
69
+ version: 9.2.2
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sensu-extension
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 1.5.0
76
+ version: 1.5.1
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 1.5.0
83
+ version: 1.5.1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: sensu-extensions
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 1.7.0
90
+ version: 1.7.1
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: 1.7.0
97
+ version: 1.7.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: sensu-transport
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: 6.0.0
104
+ version: 7.0.2
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - '='
110
110
  - !ruby/object:Gem::Version
111
- version: 6.0.0
111
+ version: 7.0.2
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: sensu-spawn
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: 2.2.0
118
+ version: 2.2.1
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: 2.2.0
125
+ version: 2.2.1
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: sensu-redis
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: 1.6.0
132
+ version: 2.0.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: 1.6.0
139
+ version: 2.0.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: em-http-server
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -275,12 +275,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - ">="
278
+ - - ">"
279
279
  - !ruby/object:Gem::Version
280
- version: '0'
280
+ version: 1.3.1
281
281
  requirements: []
282
282
  rubyforge_project:
283
- rubygems_version: 2.6.6
283
+ rubygems_version: 2.6.3
284
284
  signing_key:
285
285
  specification_version: 4
286
286
  summary: A monitoring framework