sensu-redis 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sensu/redis/sentinel.rb +20 -8
- data/sensu-redis.gemspec +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5939b7177d92baf80d426264a3243a6d0920d9dd
|
4
|
+
data.tar.gz: eee5530168c09cadb6eb766a62e4056e112c77b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1105045f20f729b050ea48fe32cb89162debddd8e07243a8bd7ea9a1d788c5c73e4ddb7fbcb33c8fcf21c7d67c71b60f0292b6d0aef4829970c9d37111c9ff37
|
7
|
+
data.tar.gz: d1d84791dc6aec961652f85d7064484a20e36662d2378c4ee85f4f11e1019dfdded03c2f1eef97e937cb0efa3a9feaa6d29a244c809c3c981a7cdee3a5fc58a4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sensu/redis/sentinel.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require "sensu/redis/client"
|
2
|
+
require "sensu/redis/utilities"
|
2
3
|
require "eventmachine"
|
3
4
|
|
4
5
|
module Sensu
|
5
6
|
module Redis
|
6
7
|
class Sentinel
|
8
|
+
include Utilities
|
9
|
+
|
7
10
|
attr_accessor :logger
|
8
11
|
|
9
12
|
# Initialize the Sentinel connections. The default Redis master
|
@@ -15,26 +18,35 @@ module Sensu
|
|
15
18
|
# connection settings.
|
16
19
|
def initialize(options={})
|
17
20
|
@master = options[:master_group] || options[:master] || "mymaster"
|
18
|
-
@sentinels =
|
21
|
+
@sentinels = []
|
22
|
+
connect_to_sentinels(options[:sentinels])
|
19
23
|
end
|
20
24
|
|
21
|
-
# Connect to a Sentinel instance
|
25
|
+
# Connect to a Sentinel instance and add the connection to
|
26
|
+
# `@sentinels` to be called upon. This method defaults the
|
27
|
+
# Sentinel host and port if either have not been set.
|
22
28
|
#
|
23
29
|
# @param options [Hash] containing the host and port.
|
24
|
-
# @return [Object] Sentinel connection.
|
25
30
|
def connect_to_sentinel(options={})
|
26
31
|
options[:host] ||= "127.0.0.1"
|
27
32
|
options[:port] ||= 26379
|
28
|
-
|
33
|
+
resolve_host(options[:host]) do |ip_address|
|
34
|
+
if ip_address.nil?
|
35
|
+
EM::Timer.new(1) do
|
36
|
+
connect_to_sentinel(options)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
@sentinels << EM.connect(ip_address, options[:port].to_i, Client, options)
|
40
|
+
end
|
41
|
+
end
|
29
42
|
end
|
30
43
|
|
31
|
-
# Connect to all Sentinel instances.
|
32
|
-
#
|
44
|
+
# Connect to all Sentinel instances. The Sentinel instance
|
45
|
+
# connections will be added to `@sentinels`.
|
33
46
|
#
|
34
47
|
# @param sentinels [Array]
|
35
|
-
# @return [Array] of Sentinel connection objects.
|
36
48
|
def connect_to_sentinels(sentinels)
|
37
|
-
sentinels.
|
49
|
+
sentinels.each do |options|
|
38
50
|
connect_to_sentinel(options)
|
39
51
|
end
|
40
52
|
end
|
data/sensu-redis.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
jOeGyhtQa9j4FFmsEJDg59f5v/3hECXsa3Xuml3foaFHzX3Ya/YIyd2YFxvkFKIu
|
31
31
|
GVbe7A3YdxzdkH2Es/Ym9twdxXaIDdXzj8sWhw==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-
|
33
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: eventmachine
|
metadata.gz.sig
CHANGED
Binary file
|