eye 0.9.pre → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGES.md +10 -0
- data/examples/custom_trigger.eye +1 -1
- data/examples/triggers.eye +1 -1
- data/lib/eye.rb +1 -1
- data/lib/eye/checker.rb +5 -5
- data/lib/eye/checker/http.rb +5 -5
- data/lib/eye/checker/socket.rb +3 -3
- data/lib/eye/client.rb +10 -3
- data/lib/eye/dsl/config_opts.rb +1 -1
- data/lib/eye/dsl/opts.rb +5 -5
- data/lib/eye/notify/jabber.rb +1 -1
- data/lib/eye/notify/mail.rb +1 -1
- data/lib/eye/server.rb +4 -3
- data/lib/eye/trigger/flapping.rb +6 -6
- data/lib/eye/trigger/starting_guard.rb +4 -4
- data/lib/eye/trigger/stop_children.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b76b8d9060cb42b041484705984a1a7f3da93b38
|
4
|
+
data.tar.gz: ca3823da4f96ff0935b83687a1c1ef06716a1fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f87c6c0916bd8384d736c23673821c4e9ba06af76ae51293e95b451319bfec6dfe9fac50aec8903cc26679143e2b2fcd47352ade2132efdbe4d656de3a65ac
|
7
|
+
data.tar.gz: 36bded5d52f33ff52ee0908bb16fe57c5a0afab6d8d608138fd2b398b3deb3212f4772f2c26598c6c667a81a0969e05520b39225e69955ba3ae75e618c780eac
|
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
0.9.1
|
2
|
+
-------
|
3
|
+
* fix client protocol compatibility with old server
|
4
|
+
|
5
|
+
0.9
|
6
|
+
-------
|
7
|
+
* replace old gem state_machine, to state_machines
|
8
|
+
* rewrite internal scheduler for chains
|
9
|
+
* change client-server protocol (recommend to quit server and up after update gem)
|
10
|
+
|
1
11
|
0.8.1
|
2
12
|
-------
|
3
13
|
* allow matching many apps when mask started with '*' (#169)
|
data/examples/custom_trigger.eye
CHANGED
data/examples/triggers.eye
CHANGED
data/lib/eye.rb
CHANGED
data/lib/eye/checker.rb
CHANGED
@@ -23,10 +23,10 @@ class Eye::Checker
|
|
23
23
|
|
24
24
|
attr_accessor :value, :values, :options, :pid, :type, :check_count, :process
|
25
25
|
|
26
|
-
param :every, [
|
27
|
-
param :times, [
|
26
|
+
param :every, [Integer, Float], false, 5
|
27
|
+
param :times, [Integer, Array], nil, 1
|
28
28
|
param :fires, [Symbol, Array, Proc], nil, nil, [:stop, :restart, :unmonitor, :start, :delete, :nothing, :notify]
|
29
|
-
param :initial_grace, [
|
29
|
+
param :initial_grace, [Integer, Float]
|
30
30
|
param :skip_initial_fails, [TrueClass, FalseClass]
|
31
31
|
|
32
32
|
def self.name_and_class(type)
|
@@ -253,8 +253,8 @@ class Eye::Checker
|
|
253
253
|
|
254
254
|
class Measure < Eye::Checker
|
255
255
|
|
256
|
-
param :below, [
|
257
|
-
param :above, [
|
256
|
+
param :below, [Integer, Float]
|
257
|
+
param :above, [Integer, Float]
|
258
258
|
|
259
259
|
def good?(value)
|
260
260
|
return false if below && (value > below)
|
data/lib/eye/checker/http.rb
CHANGED
@@ -8,10 +8,10 @@ class Eye::Checker::Http < Eye::Checker::Defer
|
|
8
8
|
param :url, String, true
|
9
9
|
param :proxy_url, String
|
10
10
|
param :pattern, [String, Regexp]
|
11
|
-
param :kind, [String,
|
12
|
-
param :timeout, [
|
13
|
-
param :open_timeout, [
|
14
|
-
param :read_timeout, [
|
11
|
+
param :kind, [String, Integer, Symbol]
|
12
|
+
param :timeout, [Integer, Float]
|
13
|
+
param :open_timeout, [Integer, Float]
|
14
|
+
param :read_timeout, [Integer, Float]
|
15
15
|
|
16
16
|
attr_reader :uri
|
17
17
|
|
@@ -21,7 +21,7 @@ class Eye::Checker::Http < Eye::Checker::Defer
|
|
21
21
|
@uri = URI.parse(url)
|
22
22
|
@proxy_uri = URI.parse(proxy_url) if proxy_url
|
23
23
|
@kind = case kind
|
24
|
-
when
|
24
|
+
when Integer then Net::HTTPResponse::CODE_TO_OBJ[kind.to_s]
|
25
25
|
when String, Symbol then Net.const_get("HTTP#{kind.to_s.camelize}") rescue Net::HTTPSuccess
|
26
26
|
else Net::HTTPSuccess
|
27
27
|
end
|
data/lib/eye/checker/socket.rb
CHANGED
@@ -13,9 +13,9 @@ class Eye::Checker::Socket < Eye::Checker::Defer
|
|
13
13
|
# :protocol way of pack,unpack messages (default = socket default), example: :protocol => :em_object
|
14
14
|
|
15
15
|
param :addr, String, true
|
16
|
-
param :timeout, [
|
17
|
-
param :open_timeout, [
|
18
|
-
param :read_timeout, [
|
16
|
+
param :timeout, [Integer, Float]
|
17
|
+
param :open_timeout, [Integer, Float]
|
18
|
+
param :read_timeout, [Integer, Float]
|
19
19
|
param :send_data
|
20
20
|
param :expect_data, [String, Regexp, Proc]
|
21
21
|
param :protocol, [Symbol], nil, nil, [:default, :em_object, :raw]
|
data/lib/eye/client.rb
CHANGED
@@ -5,13 +5,20 @@ class Eye::Client
|
|
5
5
|
|
6
6
|
attr_reader :socket_path
|
7
7
|
|
8
|
-
def initialize(socket_path)
|
8
|
+
def initialize(socket_path, type = :old)
|
9
9
|
@socket_path = socket_path
|
10
|
+
@type = type
|
10
11
|
end
|
11
12
|
|
13
|
+
SIGN = 123_566_983
|
14
|
+
|
12
15
|
def execute(h = {})
|
13
|
-
payload =
|
14
|
-
|
16
|
+
payload = if @type == :old
|
17
|
+
Marshal.dump([h[:command], *h[:args]]) # TODO: remove in 1.0
|
18
|
+
else
|
19
|
+
payload = Marshal.dump(h)
|
20
|
+
[SIGN, payload.length].pack('N*') + payload
|
21
|
+
end
|
15
22
|
timeout = h[:timeout] || Eye::Local.client_timeout
|
16
23
|
attempt_command(payload, timeout)
|
17
24
|
end
|
data/lib/eye/dsl/config_opts.rb
CHANGED
data/lib/eye/dsl/opts.rb
CHANGED
@@ -11,10 +11,10 @@ class Eye::Dsl::Opts < Eye::Dsl::PureOpts
|
|
11
11
|
INTERVAL_OPTIONS = [:check_alive_period, :start_timeout, :restart_timeout, :stop_timeout, :start_grace,
|
12
12
|
:restart_grace, :stop_grace, :children_update_period, :restore_in,
|
13
13
|
:auto_update_pidfile_grace, :revert_fuckup_pidfile_grace, :check_identity_period, :check_identity_grace].freeze
|
14
|
-
create_options_methods(INTERVAL_OPTIONS, [
|
14
|
+
create_options_methods(INTERVAL_OPTIONS, [Integer, Float])
|
15
15
|
|
16
16
|
create_options_methods([:environment], Hash)
|
17
|
-
create_options_methods([:umask],
|
17
|
+
create_options_methods([:umask], Integer)
|
18
18
|
|
19
19
|
def initialize(name = nil, parent = nil)
|
20
20
|
super(name, parent)
|
@@ -212,12 +212,12 @@ private
|
|
212
212
|
while s.present?
|
213
213
|
sig = s.shift
|
214
214
|
timeout = s.shift
|
215
|
-
if sig && ![String, Symbol
|
215
|
+
if sig && !([String, Symbol].include?(sig.class) || sig.is_a?(Integer))
|
216
216
|
raise Eye::Dsl::Error, "signal should be String, Symbol, Fixnum, not #{sig.inspect}"
|
217
217
|
end
|
218
218
|
|
219
|
-
if timeout && !
|
220
|
-
raise Eye::Dsl::Error, "signal sleep should be Numeric, not #{timeout.inspect}"
|
219
|
+
if timeout && !timeout.is_a?(Numeric)
|
220
|
+
raise Eye::Dsl::Error, "signal sleep should be Numeric, not #{timeout.inspect} - #{timeout.class}"
|
221
221
|
end
|
222
222
|
end
|
223
223
|
end
|
data/lib/eye/notify/jabber.rb
CHANGED
data/lib/eye/notify/mail.rb
CHANGED
data/lib/eye/server.rb
CHANGED
@@ -34,9 +34,10 @@ class Eye::Server
|
|
34
34
|
rescue
|
35
35
|
# new format
|
36
36
|
begin
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
sign, msg_size = text[0...8].unpack('N*')
|
38
|
+
raise "unknown protocol #{sign}" unless sign == Eye::Client::SIGN
|
39
|
+
msg_size = text[4...8].unpack('N')[0]
|
40
|
+
content = text[8..-1]
|
40
41
|
content << socket.read(msg_size - content.length) while content.length < msg_size
|
41
42
|
payload = Marshal.load(content)
|
42
43
|
cmd = payload[:command]
|
data/lib/eye/trigger/flapping.rb
CHANGED
@@ -3,12 +3,12 @@ class Eye::Trigger::Flapping < Eye::Trigger
|
|
3
3
|
# trigger :flapping, :times => 10, :within => 1.minute,
|
4
4
|
# :retry_in => 10.minutes, :retry_times => 15
|
5
5
|
|
6
|
-
param :times, [
|
7
|
-
param :within, [Float,
|
8
|
-
param :retry_in, [Float,
|
9
|
-
param :retry_times, [
|
10
|
-
param :reretry_in, [Float,
|
11
|
-
param :reretry_times, [
|
6
|
+
param :times, [Integer], true, 5
|
7
|
+
param :within, [Float, Integer], true
|
8
|
+
param :retry_in, [Float, Integer]
|
9
|
+
param :retry_times, [Integer]
|
10
|
+
param :reretry_in, [Float, Integer]
|
11
|
+
param :reretry_times, [Integer]
|
12
12
|
|
13
13
|
def initialize(*args)
|
14
14
|
super
|
@@ -6,10 +6,10 @@ class Eye::Trigger::StartingGuard < Eye::Trigger
|
|
6
6
|
#
|
7
7
|
# trigger :starting_guard, every: 10.seconds, should: ->{ `cat /tmp/bla` == "bla" }
|
8
8
|
|
9
|
-
param :every, [Float,
|
10
|
-
param :times, [
|
11
|
-
param :retry_in, [Float,
|
12
|
-
param :retry_times, [
|
9
|
+
param :every, [Float, Integer], false, 10
|
10
|
+
param :times, [Integer]
|
11
|
+
param :retry_in, [Float, Integer]
|
12
|
+
param :retry_times, [Integer]
|
13
13
|
param :should, [Proc, Symbol]
|
14
14
|
|
15
15
|
def initialize(*args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eye
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Makarchev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -469,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
469
469
|
version: 1.3.6
|
470
470
|
requirements: []
|
471
471
|
rubyforge_project:
|
472
|
-
rubygems_version: 2.
|
472
|
+
rubygems_version: 2.6.6
|
473
473
|
signing_key:
|
474
474
|
specification_version: 4
|
475
475
|
summary: Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI)
|