sensu-redis 0.1.11 → 0.1.12

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: 4172f2d18d1dbcb45355ced74b16cc32df6a96c9
4
- data.tar.gz: fc2433374afbb9479b15c0ff1865c3e2f88c26e6
3
+ metadata.gz: ef76ac716c9930ed28063ef1c302e1a0d3550b5c
4
+ data.tar.gz: b909da3d8af9bd85b400be04ebaaf8554f2bdab0
5
5
  SHA512:
6
- metadata.gz: 8b6ed1d80e9a420e0e3aa3c8b89093c535edffda903cf62f02f89e04e36118c4930c5a653edaf8706d2386c5d612a5aeb4e23d20cc98c3a8866011b2902208fb
7
- data.tar.gz: 741df53a52163cb744898966789ea58ec7e448d86ac2389cebf38324f5d2f190e433d6d43bff835d6dcac1c4cc7587f6f660719d67a6a0b7a8e924ffeb726dbd
6
+ metadata.gz: 68a4029bff88c896cd8dfb3c1e0f6e9cff4803f6a10056377a196e936622cda378d858000495d7e078c8a2c259cc2578063671ff9b2aab4d833b63e13355ccb4
7
+ data.tar.gz: 9d28ca4b26d1e3118b26d310455c0ff49f18f8f9e77255cd16475b995f27001844d0f6dfff8b7482a79cc3a8105c9275ff943a27b1d516c2596c7d4dc9e9da03
data/.gitignore CHANGED
@@ -8,4 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  dump.rdb
11
- sentinel.conf
11
+ spec/configs/sentinel.conf
@@ -22,11 +22,12 @@ module Sensu
22
22
  # set the deferrable status to `:successful`, triggering any
23
23
  # queued Sentinel callback calls (e.g. `resolve()`).
24
24
  #
25
- # @param host [String]
26
- # @param port [Integer]
25
+ # @param options [Hash] containing the host and port.
27
26
  # @return [Object] Sentinel connection.
28
- def connect_to_sentinel(host, port)
29
- connection = EM.connect(host, port, Client)
27
+ def connect_to_sentinel(options={})
28
+ options[:host] ||= "127.0.0.1"
29
+ options[:port] ||= 26379
30
+ connection = EM.connect(options[:host], options[:port], Client, options)
30
31
  connection.callback do
31
32
  succeed
32
33
  end
@@ -39,10 +40,8 @@ module Sensu
39
40
  # @param sentinels [Array]
40
41
  # @return [Array] of Sentinel connection objects.
41
42
  def connect_to_sentinels(sentinels)
42
- sentinels.map do |sentinel|
43
- host = sentinel[:host] || "127.0.0.1"
44
- port = sentinel[:port] || 26379
45
- connect_to_sentinel(host, port)
43
+ sentinels.map do |options|
44
+ connect_to_sentinel(options)
46
45
  end
47
46
  end
48
47
 
data/sensu-redis.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-redis"
5
- spec.version = "0.1.11"
5
+ spec.version = "0.1.12"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu Redis client library"
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: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -102,7 +102,6 @@ files:
102
102
  - lib/sensu/redis/client/errors.rb
103
103
  - lib/sensu/redis/sentinel.rb
104
104
  - sensu-redis.gemspec
105
- - spec/configs/sentinel.conf
106
105
  homepage: https://github.com/sensu/sensu-redis
107
106
  licenses:
108
107
  - MIT
@@ -127,5 +126,4 @@ rubygems_version: 2.4.5.1
127
126
  signing_key:
128
127
  specification_version: 4
129
128
  summary: The Sensu Redis client library
130
- test_files:
131
- - spec/configs/sentinel.conf
129
+ test_files: []
@@ -1,145 +0,0 @@
1
- # port <sentinel-port>
2
- # The port that this sentinel instance will run on
3
- port 63800
4
-
5
- # sentinel monitor <master-name> <ip> <redis-port> <quorum>
6
- #
7
- # Tells Sentinel to monitor this master, and to consider it in O_DOWN
8
- # (Objectively Down) state only if at least <quorum> sentinels agree.
9
- #
10
- # Note that whatever is the ODOWN quorum, a Sentinel will require to
11
- # be elected by the majority of the known Sentinels in order to
12
- # start a failover, so no failover can be performed in minority.
13
- #
14
- # Note: master name should not include special characters or spaces.
15
- # The valid charset is A-z 0-9 and the three characters ".-_".
16
- sentinel monitor mymaster 127.0.0.1 6379 2
17
-
18
- sentinel auth-pass mymaster secret
19
- #
20
- # Set the password to use to authenticate with the master and slaves.
21
- # Useful if there is a password set in the Redis instances to monitor.
22
- #
23
- # Note that the master password is also used for slaves, so it is not
24
- # possible to set a different password in masters and slaves instances
25
- # if you want to be able to monitor these instances with Sentinel.
26
- #
27
- # However you can have Redis instances without the authentication enabled
28
- # mixed with Redis instances requiring the authentication (as long as the
29
- # password set is the same for all the instances requiring the password) as
30
- # the AUTH command will have no effect in Redis instances with authentication
31
- # switched off.
32
- #
33
- # Example:
34
- #
35
- # sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
36
-
37
- # sentinel down-after-milliseconds <master-name> <milliseconds>
38
- #
39
- # Number of milliseconds the master (or any attached slave or sentinel) should
40
- # be unreachable (as in, not acceptable reply to PING, continuously, for the
41
- # specified period) in order to consider it in S_DOWN state (Subjectively
42
- # Down).
43
- #
44
- # Default is 30 seconds.
45
- sentinel config-epoch mymaster 0
46
-
47
- # sentinel parallel-syncs <master-name> <numslaves>
48
- #
49
- # How many slaves we can reconfigure to point to the new slave simultaneously
50
- # during the failover. Use a low number if you use the slaves to serve query
51
- # to avoid that all the slaves will be unreachable at about the same
52
- # time while performing the synchronization with the master.
53
- sentinel known-slave mymaster 127.0.0.1 6380
54
-
55
- # sentinel failover-timeout <master-name> <milliseconds>
56
- #
57
- # Specifies the failover timeout in milliseconds. It is used in many ways:
58
- #
59
- # - The time needed to re-start a failover after a previous failover was
60
- # already tried against the same master by a given Sentinel, is two
61
- # times the failover timeout.
62
- #
63
- # - The time needed for a slave replicating to a wrong master according
64
- # to a Sentinel current configuration, to be forced to replicate
65
- # with the right master, is exactly the failover timeout (counting since
66
- # the moment a Sentinel detected the misconfiguration).
67
- #
68
- # - The time needed to cancel a failover that is already in progress but
69
- # did not produced any configuration change (SLAVEOF NO ONE yet not
70
- # acknowledged by the promoted slave).
71
- #
72
- # - The maximum time a failover in progress waits for all the slaves to be
73
- # reconfigured as slaves of the new master. However even after this time
74
- # the slaves will be reconfigured by the Sentinels anyway, but not with
75
- # the exact parallel-syncs progression as specified.
76
- #
77
- # Default is 3 minutes.
78
- sentinel known-sentinel mymaster 127.0.0.1 63810 c0e485ef82e667ba43b7bffedd7b7c2f080248a8
79
-
80
- # SCRIPTS EXECUTION
81
- #
82
- # sentinel notification-script and sentinel reconfig-script are used in order
83
- # to configure scripts that are called to notify the system administrator
84
- # or to reconfigure clients after a failover. The scripts are executed
85
- # with the following rules for error handling:
86
- #
87
- # If script exists with "1" the execution is retried later (up to a maximum
88
- # number of times currently set to 10).
89
- #
90
- # If script exists with "2" (or an higher value) the script execution is
91
- # not retried.
92
- #
93
- # If script terminates because it receives a signal the behavior is the same
94
- # as exit code 1.
95
- #
96
- # A script has a maximum running time of 60 seconds. After this limit is
97
- # reached the script is terminated with a SIGKILL and the execution retried.
98
-
99
- # NOTIFICATION SCRIPT
100
- #
101
- # sentinel notification-script <master-name> <script-path>
102
- #
103
- # Call the specified notification script for any sentinel event that is
104
- # generated in the WARNING level (for instance -sdown, -odown, and so forth).
105
- # This script should notify the system administrator via email, SMS, or any
106
- # other messaging system, that there is something wrong with the monitored
107
- # Redis systems.
108
- #
109
- # The script is called with just two arguments: the first is the event type
110
- # and the second the event description.
111
- #
112
- # The script must exist and be executable in order for sentinel to start if
113
- # this option is provided.
114
- #
115
- # Example:
116
- #
117
- # sentinel notification-script mymaster /var/redis/notify.sh
118
-
119
- # CLIENTS RECONFIGURATION SCRIPT
120
- #
121
- # sentinel client-reconfig-script <master-name> <script-path>
122
- #
123
- # When the master changed because of a failover a script can be called in
124
- # order to perform application-specific tasks to notify the clients that the
125
- # configuration has changed and the master is at a different address.
126
- #
127
- # The following arguments are passed to the script:
128
- #
129
- # <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
130
- #
131
- # <state> is currently always "failover"
132
- # <role> is either "leader" or "observer"
133
- #
134
- # The arguments from-ip, from-port, to-ip, to-port are used to communicate
135
- # the old address of the master and the new address of the elected slave
136
- # (now a master).
137
- #
138
- # This script should be resistant to multiple invocations.
139
- #
140
- # Example:
141
- #
142
- # sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
143
- # Generated by CONFIG REWRITE
144
- dir "/home/portertech/projects/sensu/sensu-redis/spec/configs"
145
- sentinel known-sentinel mymaster 127.0.0.1 63790 092d28f730ac45be8f18569fefa12b0ebd7b230b