sensu 0.16.0-java → 0.17.0.beta.1-java

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.
@@ -0,0 +1,21 @@
1
+ module Sensu
2
+ module Server
3
+ module Sandbox
4
+ # Evaluate a Ruby expression within the context of a simple
5
+ # "sandbox", a Proc in a module method. Use the Ruby `$SAFE`
6
+ # level of 4 when the version of Ruby is less than 2.1.0. A
7
+ # single value is provided to the "sandbox".
8
+ #
9
+ # @param expression [String] to be evaluated.
10
+ # @param value [Object] to provide the "sandbox" with.
11
+ # @return [Object]
12
+ def self.eval(expression, value=nil)
13
+ result = Proc.new do
14
+ $SAFE = (RUBY_VERSION < "2.1.0" ? 4 : 3)
15
+ Kernel.eval(expression)
16
+ end
17
+ result.call
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,42 @@
1
+ module Sensu
2
+ module Server
3
+ class Socket < EM::Connection
4
+ # @!attribute [rw] on_success
5
+ # @return [Proc] callback to be called after the data has been
6
+ # transmitted successfully.
7
+ attr_accessor :on_success
8
+
9
+ # @!attribute [rw] on_error
10
+ # @return [Proc] callback to be called when there is an error.
11
+ attr_accessor :on_error
12
+
13
+ # Record the current time and the inactivity timeout value, when
14
+ # the socket connection is successful. These values are used to
15
+ # determine if the a connection was closed due to the timeout.
16
+ def connection_completed
17
+ @connected_at = Time.now.to_f
18
+ @inactivity_timeout = comm_inactivity_timeout
19
+ end
20
+
21
+ # Determine if the connection and data transmission was
22
+ # successful and call the appropriate callback, `@on_success`
23
+ # or `@on_error`, providing it with a message. The
24
+ # `@connected_at` timestamp indicates that the connection was
25
+ # successful. If the elapsed time is greater than the inactivity
26
+ # timeout value, the connection was closed abruptly by the
27
+ # timeout timer, and the data was not transmitted.
28
+ def unbind
29
+ if @connected_at
30
+ elapsed_time = Time.now.to_f - @connected_at
31
+ if elapsed_time >= @inactivity_timeout
32
+ @on_error.call("socket inactivity timeout")
33
+ else
34
+ @on_success.call("wrote to socket")
35
+ end
36
+ else
37
+ @on_error.call("failed to connect to socket")
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,13 +1,22 @@
1
- gem 'uuidtools', '2.1.4'
1
+ gem "uuidtools", "2.1.4"
2
2
 
3
- require 'uuidtools'
3
+ require "uuidtools"
4
4
 
5
5
  module Sensu
6
6
  module Utilities
7
+ # Determine if Sensu is being tested, using the process name.
8
+ # Sensu is being test if the process name is "rspec",
9
+ #
10
+ # @return [TrueClass, FalseClass]
7
11
  def testing?
8
- File.basename($0) == 'rspec'
12
+ File.basename($0) == "rspec"
9
13
  end
10
14
 
15
+ # Retry a code block until it retures true. The first attempt and
16
+ # following retries are delayed.
17
+ #
18
+ # @param wait [Numeric] time to delay block calls.
19
+ # @param block [Proc] to call that needs to return true.
11
20
  def retry_until_true(wait=0.5, &block)
12
21
  EM::Timer.new(wait) do
13
22
  unless block.call
@@ -16,6 +25,12 @@ module Sensu
16
25
  end
17
26
  end
18
27
 
28
+ # Deep merge two hashes. Nested hashes are deep merged, arrays are
29
+ # concatenated and duplicate array items are removed.
30
+ #
31
+ # @param hash_one [Hash]
32
+ # @param hash_two [Hash]
33
+ # @return [Hash] deep merged hash.
19
34
  def deep_merge(hash_one, hash_two)
20
35
  merged = hash_one.dup
21
36
  hash_two.each do |key, value|
@@ -31,10 +46,21 @@ module Sensu
31
46
  merged
32
47
  end
33
48
 
49
+ # Generate a random universally unique identifier.
50
+ #
51
+ # @return [String] random UUID.
34
52
  def random_uuid
35
53
  UUIDTools::UUID.random_create.to_s
36
54
  end
37
55
 
56
+ # Remove sensitive information from a hash (eg. passwords). By
57
+ # default, hash values will be redacted for the following keys:
58
+ # password, passwd, pass, api_key, api_token, access_key,
59
+ # secret_key, private_key, secret
60
+ #
61
+ # @param hash [Hash] to redact sensitive value from.
62
+ # @param keys [Array] that indicate sensitive values.
63
+ # @return [Hash] hash with redacted sensitive values.
38
64
  def redact_sensitive(hash, keys=nil)
39
65
  keys ||= %w[
40
66
  password passwd pass
data/sensu.gemspec CHANGED
@@ -1,38 +1,39 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.join(File.dirname(__FILE__), 'lib', 'sensu', 'constants')
2
+ require File.join(File.dirname(__FILE__), "lib", "sensu", "constants")
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = 'sensu'
5
+ s.name = "sensu"
6
6
  s.version = Sensu::VERSION
7
7
  s.platform = RUBY_PLATFORM =~ /java/ ? Gem::Platform::JAVA : Gem::Platform::RUBY
8
- s.authors = ['Sean Porter', 'Justin Kolberg']
9
- s.email = ['portertech@gmail.com', 'justin.kolberg@sonian.net']
10
- s.homepage = 'https://github.com/sensu/sensu'
11
- s.summary = 'A monitoring framework'
12
- s.description = 'A monitoring framework that aims to be simple, malleable, and scalable.'
13
- s.license = 'MIT'
8
+ s.authors = ["Sean Porter", "Justin Kolberg"]
9
+ s.email = ["portertech@gmail.com", "amdprophet@gmail.com"]
10
+ s.homepage = "https://github.com/sensu/sensu"
11
+ s.summary = "A monitoring framework"
12
+ s.description = "A monitoring framework that aims to be simple, malleable, and scalable."
13
+ s.license = "MIT"
14
14
  s.has_rdoc = false
15
15
 
16
- s.add_dependency('json') if RUBY_VERSION < "1.9"
17
- s.add_dependency('multi_json', '1.10.1')
18
- s.add_dependency('uuidtools', '2.1.4')
19
- s.add_dependency('sensu-em', '2.4.0')
20
- s.add_dependency('sensu-logger', '1.0.0')
21
- s.add_dependency('sensu-settings', '1.2.0')
22
- s.add_dependency('sensu-extension', '1.0.0')
23
- s.add_dependency('sensu-extensions', '1.0.0')
24
- s.add_dependency('sensu-transport', '2.4.0')
25
- s.add_dependency('sensu-spawn', '1.1.0')
26
- s.add_dependency('em-redis-unified', '0.5.0')
27
- s.add_dependency('sinatra', '1.3.5')
28
- s.add_dependency('async_sinatra', '1.0.0')
29
- s.add_dependency('thin', '1.5.0') unless RUBY_PLATFORM =~ /java/
16
+ s.add_dependency "json" if RUBY_VERSION < "1.9"
17
+ s.add_dependency "multi_json", "1.10.1"
18
+ s.add_dependency "uuidtools", "2.1.4"
19
+ s.add_dependency "eventmachine", "1.0.3"
20
+ s.add_dependency "sensu-em", "2.4.1"
21
+ s.add_dependency "sensu-logger", "1.0.0"
22
+ s.add_dependency "sensu-settings", "1.2.0"
23
+ s.add_dependency "sensu-extension", "1.1.2"
24
+ s.add_dependency "sensu-extensions", "1.1.0"
25
+ s.add_dependency "sensu-transport", "2.4.0"
26
+ s.add_dependency "sensu-spawn", "1.1.0"
27
+ s.add_dependency "em-redis-unified", "0.5.0"
28
+ s.add_dependency "sinatra", "1.3.5"
29
+ s.add_dependency "async_sinatra", "1.0.0"
30
+ s.add_dependency "thin", "1.5.0" unless RUBY_PLATFORM =~ /java/
30
31
 
31
- s.add_development_dependency('rake', '~> 10.3')
32
- s.add_development_dependency('rspec', '~> 3.0.0')
33
- s.add_development_dependency('em-http-request', '~> 1.1')
32
+ s.add_development_dependency "rake", "~> 10.3"
33
+ s.add_development_dependency "rspec", "~> 3.0.0"
34
+ s.add_development_dependency "em-http-request", "~> 1.1"
34
35
 
35
- s.files = Dir.glob('{bin,lib}/**/*') + %w[sensu.gemspec README.md CHANGELOG.md MIT-LICENSE.txt]
36
- s.executables = Dir.glob('bin/**/*').map { |file| File.basename(file) }
37
- s.require_paths = ['lib']
36
+ s.files = Dir.glob("{bin,lib}/**/*") + %w[sensu.gemspec README.md CHANGELOG.md MIT-LICENSE.txt]
37
+ s.executables = Dir.glob("bin/**/*").map { |file| File.basename(file) }
38
+ s.require_paths = ["lib"]
38
39
  end
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.16.0
4
+ version: 0.17.0.beta.1
5
5
  platform: java
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: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2015-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -39,18 +39,32 @@ dependencies:
39
39
  version: 2.1.4
40
40
  prerelease: false
41
41
  type: :runtime
42
+ - !ruby/object:Gem::Dependency
43
+ name: eventmachine
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.0.3
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.3
54
+ prerelease: false
55
+ type: :runtime
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: sensu-em
44
58
  version_requirements: !ruby/object:Gem::Requirement
45
59
  requirements:
46
60
  - - '='
47
61
  - !ruby/object:Gem::Version
48
- version: 2.4.0
62
+ version: 2.4.1
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - '='
52
66
  - !ruby/object:Gem::Version
53
- version: 2.4.0
67
+ version: 2.4.1
54
68
  prerelease: false
55
69
  type: :runtime
56
70
  - !ruby/object:Gem::Dependency
@@ -87,12 +101,12 @@ dependencies:
87
101
  requirements:
88
102
  - - '='
89
103
  - !ruby/object:Gem::Version
90
- version: 1.0.0
104
+ version: 1.1.2
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - '='
94
108
  - !ruby/object:Gem::Version
95
- version: 1.0.0
109
+ version: 1.1.2
96
110
  prerelease: false
97
111
  type: :runtime
98
112
  - !ruby/object:Gem::Dependency
@@ -101,12 +115,12 @@ dependencies:
101
115
  requirements:
102
116
  - - '='
103
117
  - !ruby/object:Gem::Version
104
- version: 1.0.0
118
+ version: 1.1.0
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - '='
108
122
  - !ruby/object:Gem::Version
109
- version: 1.0.0
123
+ version: 1.1.0
110
124
  prerelease: false
111
125
  type: :runtime
112
126
  - !ruby/object:Gem::Dependency
@@ -224,7 +238,7 @@ dependencies:
224
238
  description: A monitoring framework that aims to be simple, malleable, and scalable.
225
239
  email:
226
240
  - portertech@gmail.com
227
- - justin.kolberg@sonian.net
241
+ - amdprophet@gmail.com
228
242
  executables:
229
243
  - sensu-server
230
244
  - sensu-client
@@ -236,16 +250,20 @@ files:
236
250
  - bin/sensu-client
237
251
  - bin/sensu-api
238
252
  - lib/sensu.rb
239
- - lib/sensu/socket.rb
240
- - lib/sensu/server.rb
241
253
  - lib/sensu/constants.rb
242
- - lib/sensu/client.rb
243
- - lib/sensu/sandbox.rb
244
254
  - lib/sensu/daemon.rb
245
255
  - lib/sensu/cli.rb
246
256
  - lib/sensu/redis.rb
247
257
  - lib/sensu/utilities.rb
248
- - lib/sensu/api.rb
258
+ - lib/sensu/client/socket.rb
259
+ - lib/sensu/client/process.rb
260
+ - lib/sensu/server/handle.rb
261
+ - lib/sensu/server/socket.rb
262
+ - lib/sensu/server/sandbox.rb
263
+ - lib/sensu/server/process.rb
264
+ - lib/sensu/server/mutate.rb
265
+ - lib/sensu/server/filter.rb
266
+ - lib/sensu/api/process.rb
249
267
  - sensu.gemspec
250
268
  - README.md
251
269
  - CHANGELOG.md
@@ -265,9 +283,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
283
  version: '0'
266
284
  required_rubygems_version: !ruby/object:Gem::Requirement
267
285
  requirements:
268
- - - '>='
286
+ - - '>'
269
287
  - !ruby/object:Gem::Version
270
- version: '0'
288
+ version: 1.3.1
271
289
  requirements: []
272
290
  rubyforge_project:
273
291
  rubygems_version: 2.1.9