sensu 0.20.5 → 0.20.6

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: 8007404a6dd86529b0ec5641f44251fb1f66e381
4
- data.tar.gz: 2169f30451c9c3fe065fee86698e9093d0edc33d
3
+ metadata.gz: 8db94deef76774c21c9200b21055c0cedc6c1907
4
+ data.tar.gz: 067c5f4dedbb6315d62c77a1dbe769bd18b6442d
5
5
  SHA512:
6
- metadata.gz: 4b24da36fda299858ed7c49e484ff569ad0fb8050395093352e9768391480c90f136adb2339bfa7d7b82b6039fbcb7cda9236a598a19540b06de2a61de698c60
7
- data.tar.gz: cee8022b8fcc784ff5fbf5b9fb6e92a1620549deac35c4728df69ee6cbaecdf314cdd24a7f59c5ede5cd0f53c8d18f5020c8feea2e2c1223d9719d0790f6c1d7
6
+ metadata.gz: 0a620e6977eabe3657cfa23409f5732fe9d7a79985752290eafd939b5f0966b3885ded2d47c14c9a9ade611a464cd9ff483fa8f79e14d5ccdd64ddb124c7b01a
7
+ data.tar.gz: 4d40cdcb998419822642090121c34aded2a47e7c094c4b084516ff0ad7893701ff0598cdaa6a0a5c4922bf686b099086bb9db7f3e739d52a11d7d090fd86a085
@@ -1,3 +1,17 @@
1
+ ## 0.20.6 - 2015-09-22
2
+
3
+ ### Other
4
+
5
+ Removed sensu-em as a dependency, now using upstream EventMachine 1.0.8.
6
+
7
+ The Sensu API will remove a client immediately if there are no current
8
+ events for it. The API will continue to monitor the current event count
9
+ for the client to be deleted, deleting the client when there are no longer
10
+ current events or after a timeout of 5 seconds.
11
+
12
+ The Sensu API will no longer crash while fetching check result data for a
13
+ client that is being deleted.
14
+
1
15
  ## 0.20.5 - 2015-09-09
2
16
 
3
17
  ### Other
@@ -337,9 +337,7 @@ module Sensu
337
337
  unless client_json.nil?
338
338
  response << MultiJson.load(client_json)
339
339
  else
340
- settings.logger.error("client registry missing data for client", {
341
- :client_name => client_name
342
- })
340
+ settings.logger.error("client data missing from registry", :client_name => client_name)
343
341
  settings.redis.srem("clients", client_name)
344
342
  end
345
343
  if index == clients.size - 1
@@ -375,17 +373,19 @@ module Sensu
375
373
  status.to_i
376
374
  end
377
375
  settings.redis.get("result:#{result_key}") do |result_json|
378
- result = MultiJson.load(result_json)
379
- last_execution = result[:executed]
380
- unless history.empty? || last_execution.nil?
381
- item = {
382
- :check => check_name,
383
- :history => history,
384
- :last_execution => last_execution.to_i,
385
- :last_status => history.last,
386
- :last_result => result
387
- }
388
- response << item
376
+ unless result_json.nil?
377
+ result = MultiJson.load(result_json)
378
+ last_execution = result[:executed]
379
+ unless history.empty? || last_execution.nil?
380
+ item = {
381
+ :check => check_name,
382
+ :history => history,
383
+ :last_execution => last_execution.to_i,
384
+ :last_status => history.last,
385
+ :last_result => result
386
+ }
387
+ response << item
388
+ end
389
389
  end
390
390
  if index == checks.size - 1
391
391
  body MultiJson.dump(response)
@@ -406,22 +406,31 @@ module Sensu
406
406
  events.each do |check_name, event_json|
407
407
  resolve_event(event_json)
408
408
  end
409
- EM::Timer.new(5) do
410
- client = MultiJson.load(client_json)
411
- settings.logger.info("deleting client", :client => client)
412
- settings.redis.srem("clients", client_name) do
413
- settings.redis.del("client:#{client_name}")
414
- settings.redis.del("events:#{client_name}")
415
- settings.redis.smembers("result:#{client_name}") do |checks|
416
- checks.each do |check_name|
417
- result_key = "#{client_name}:#{check_name}"
418
- settings.redis.del("result:#{result_key}")
419
- settings.redis.del("history:#{result_key}")
409
+ delete_client = Proc.new do |attempts|
410
+ attempts += 1
411
+ settings.redis.hgetall("events:#{client_name}") do |events|
412
+ if events.empty? || attempts == 5
413
+ settings.logger.info("deleting client from registry", :client_name => client_name)
414
+ settings.redis.srem("clients", client_name) do
415
+ settings.redis.del("client:#{client_name}")
416
+ settings.redis.del("events:#{client_name}")
417
+ settings.redis.smembers("result:#{client_name}") do |checks|
418
+ checks.each do |check_name|
419
+ result_key = "#{client_name}:#{check_name}"
420
+ settings.redis.del("result:#{result_key}")
421
+ settings.redis.del("history:#{result_key}")
422
+ end
423
+ settings.redis.del("result:#{client_name}")
424
+ end
425
+ end
426
+ else
427
+ EM::Timer.new(1) do
428
+ delete_client.call(attempts)
420
429
  end
421
- settings.redis.del("result:#{client_name}")
422
430
  end
423
431
  end
424
432
  end
433
+ delete_client.call(0)
425
434
  issued!
426
435
  end
427
436
  else
@@ -744,8 +753,10 @@ module Sensu
744
753
  checks.each_with_index do |check_name, check_index|
745
754
  result_key = "result:#{client_name}:#{check_name}"
746
755
  settings.redis.get(result_key) do |result_json|
747
- check = MultiJson.load(result_json)
748
- response << {:client => client_name, :check => check}
756
+ unless result_json.nil?
757
+ check = MultiJson.load(result_json)
758
+ response << {:client => client_name, :check => check}
759
+ end
749
760
  if client_index == clients.size - 1 && check_index == checks.size - 1
750
761
  body MultiJson.dump(response)
751
762
  end
@@ -769,8 +780,10 @@ module Sensu
769
780
  checks.each_with_index do |check_name, check_index|
770
781
  result_key = "result:#{client_name}:#{check_name}"
771
782
  settings.redis.get(result_key) do |result_json|
772
- check = MultiJson.load(result_json)
773
- response << {:client => client_name, :check => check}
783
+ unless result_json.nil?
784
+ check = MultiJson.load(result_json)
785
+ response << {:client => client_name, :check => check}
786
+ end
774
787
  if check_index == checks.size - 1
775
788
  body MultiJson.dump(response)
776
789
  end
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
3
  # Sensu release version.
4
- VERSION = "0.20.5"
4
+ VERSION = "0.20.6"
5
5
 
6
6
  # Sensu check severities.
7
7
  SEVERITIES = %w[ok warning critical unknown]
@@ -1,14 +1,14 @@
1
1
  require "rubygems"
2
2
 
3
3
  gem "multi_json", "1.11.2"
4
+ gem "eventmachine", "1.0.8"
4
5
 
5
- gem "sensu-em", "2.5.2"
6
- gem "sensu-logger", "1.0.0"
6
+ gem "sensu-logger", "1.1.0"
7
7
  gem "sensu-settings", "3.1.0"
8
- gem "sensu-extension", "1.1.2"
9
- gem "sensu-extensions", "1.2.0"
10
- gem "sensu-transport", "3.2.1"
11
- gem "sensu-spawn", "1.4.0"
8
+ gem "sensu-extension", "1.2.0"
9
+ gem "sensu-extensions", "1.3.0"
10
+ gem "sensu-transport", "3.3.0"
11
+ gem "sensu-spawn", "1.5.0"
12
12
 
13
13
  require "time"
14
14
  require "uri"
@@ -259,16 +259,17 @@ module Sensu
259
259
  def event_filtered?(handler, event, &callback)
260
260
  if handler.has_key?(:filters) || handler.has_key?(:filter)
261
261
  filter_list = Array(handler[:filters] || handler[:filter])
262
- filter_results = EM::Iterator.new(filter_list)
263
- run_filters = Proc.new do |filter_name, iterator|
264
- event_filter(filter_name, event) do |filtered|
265
- iterator.return(filtered)
262
+ filter = Proc.new do |filter_list|
263
+ filter_name = filter_list.shift
264
+ if filter_name.nil?
265
+ callback.call(false)
266
+ else
267
+ event_filter(filter_name, event) do |filtered|
268
+ filtered ? callback.call(true) : EM.next_tick { filter.call(filter_list) }
269
+ end
266
270
  end
267
271
  end
268
- filtered = Proc.new do |results|
269
- callback.call(results.any?)
270
- end
271
- filter_results.map(run_filters, filtered)
272
+ EM.next_tick { filter.call(filter_list) }
272
273
  else
273
274
  callback.call(false)
274
275
  end
@@ -16,14 +16,13 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency "json" if RUBY_VERSION < "1.9"
17
17
  s.add_dependency "multi_json", "1.11.2"
18
18
  s.add_dependency "uuidtools", "2.1.5"
19
- s.add_dependency "eventmachine", "1.0.3"
20
- s.add_dependency "sensu-em", "2.5.2"
21
- s.add_dependency "sensu-logger", "1.0.0"
19
+ s.add_dependency "eventmachine", "1.0.8"
20
+ s.add_dependency "sensu-logger", "1.1.0"
22
21
  s.add_dependency "sensu-settings", "3.1.0"
23
- s.add_dependency "sensu-extension", "1.1.2"
24
- s.add_dependency "sensu-extensions", "1.2.0"
25
- s.add_dependency "sensu-transport", "3.2.1"
26
- s.add_dependency "sensu-spawn", "1.4.0"
22
+ s.add_dependency "sensu-extension", "1.2.0"
23
+ s.add_dependency "sensu-extensions", "1.3.0"
24
+ s.add_dependency "sensu-transport", "3.3.0"
25
+ s.add_dependency "sensu-spawn", "1.5.0"
27
26
  s.add_dependency "em-redis-unified", "1.0.0"
28
27
  s.add_dependency "sinatra", "1.4.6"
29
28
  s.add_dependency "async_sinatra", "1.2.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.20.5
4
+ version: 0.20.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-09 00:00:00.000000000 Z
12
+ date: 2015-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -45,42 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.0.3
48
+ version: 1.0.8
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.0.3
56
- - !ruby/object:Gem::Dependency
57
- name: sensu-em
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - '='
61
- - !ruby/object:Gem::Version
62
- version: 2.5.2
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - '='
68
- - !ruby/object:Gem::Version
69
- version: 2.5.2
55
+ version: 1.0.8
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: sensu-logger
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
60
  - - '='
75
61
  - !ruby/object:Gem::Version
76
- version: 1.0.0
62
+ version: 1.1.0
77
63
  type: :runtime
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
67
  - - '='
82
68
  - !ruby/object:Gem::Version
83
- version: 1.0.0
69
+ version: 1.1.0
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: sensu-settings
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -101,56 +87,56 @@ dependencies:
101
87
  requirements:
102
88
  - - '='
103
89
  - !ruby/object:Gem::Version
104
- version: 1.1.2
90
+ version: 1.2.0
105
91
  type: :runtime
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - '='
110
96
  - !ruby/object:Gem::Version
111
- version: 1.1.2
97
+ version: 1.2.0
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: sensu-extensions
114
100
  requirement: !ruby/object:Gem::Requirement
115
101
  requirements:
116
102
  - - '='
117
103
  - !ruby/object:Gem::Version
118
- version: 1.2.0
104
+ version: 1.3.0
119
105
  type: :runtime
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
108
  requirements:
123
109
  - - '='
124
110
  - !ruby/object:Gem::Version
125
- version: 1.2.0
111
+ version: 1.3.0
126
112
  - !ruby/object:Gem::Dependency
127
113
  name: sensu-transport
128
114
  requirement: !ruby/object:Gem::Requirement
129
115
  requirements:
130
116
  - - '='
131
117
  - !ruby/object:Gem::Version
132
- version: 3.2.1
118
+ version: 3.3.0
133
119
  type: :runtime
134
120
  prerelease: false
135
121
  version_requirements: !ruby/object:Gem::Requirement
136
122
  requirements:
137
123
  - - '='
138
124
  - !ruby/object:Gem::Version
139
- version: 3.2.1
125
+ version: 3.3.0
140
126
  - !ruby/object:Gem::Dependency
141
127
  name: sensu-spawn
142
128
  requirement: !ruby/object:Gem::Requirement
143
129
  requirements:
144
130
  - - '='
145
131
  - !ruby/object:Gem::Version
146
- version: 1.4.0
132
+ version: 1.5.0
147
133
  type: :runtime
148
134
  prerelease: false
149
135
  version_requirements: !ruby/object:Gem::Requirement
150
136
  requirements:
151
137
  - - '='
152
138
  - !ruby/object:Gem::Version
153
- version: 1.4.0
139
+ version: 1.5.0
154
140
  - !ruby/object:Gem::Dependency
155
141
  name: em-redis-unified
156
142
  requirement: !ruby/object:Gem::Requirement
@@ -307,3 +293,4 @@ signing_key:
307
293
  specification_version: 4
308
294
  summary: A monitoring framework
309
295
  test_files: []
296
+ has_rdoc: false