eye 0.4.1 → 0.4.2
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.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -1
- data/lib/eye.rb +1 -1
- data/lib/eye/checker.rb +21 -2
- data/lib/eye/system.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: 4cc2e7aadccf1d14e140a5973af361dbb08095e9
|
4
|
+
data.tar.gz: 2a893e150885625c221d598f9a0dcddf4040e076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e97e29338ad7de4c16f4c36b599f911625431b0680e96a523e04b8ba8046730270b80af718b55d323c2524952477a876f3e097be67ee3ecf3d1cf1ec4b3c18f
|
7
|
+
data.tar.gz: f284102b968e833691aab4cccac606f6bb2815dbcc9514203ac687f607c2603e8f12b0e18cb3daddbf09569e217d1e9c6ae4ad86232a63e5c32a10958eb5b1dc
|
data/CHANGES.md
CHANGED
data/lib/eye.rb
CHANGED
data/lib/eye/checker.rb
CHANGED
@@ -18,6 +18,8 @@ class Eye::Checker
|
|
18
18
|
param :every, [Fixnum, Float], false, 5
|
19
19
|
param :times, [Fixnum, Array], nil, 1
|
20
20
|
param :fires, [Symbol, Array], nil, nil, [:stop, :restart, :unmonitor, :nothing, :start, :delete]
|
21
|
+
param :initial_grace, [Fixnum, Float]
|
22
|
+
param :skip_initial_fails, [TrueClass, FalseClass]
|
21
23
|
|
22
24
|
def self.name_and_class(type)
|
23
25
|
type = type.to_sym
|
@@ -50,9 +52,10 @@ class Eye::Checker
|
|
50
52
|
def initialize(pid, options = {}, process = nil)
|
51
53
|
@process = process
|
52
54
|
@pid = pid
|
53
|
-
@options = options
|
55
|
+
@options = options.dup
|
54
56
|
@type = options[:type]
|
55
57
|
@full_name = @process.full_name if @process
|
58
|
+
@initialized_at = Time.now
|
56
59
|
|
57
60
|
debug "create checker, with #{options}"
|
58
61
|
|
@@ -83,8 +86,16 @@ class Eye::Checker
|
|
83
86
|
end
|
84
87
|
|
85
88
|
def check
|
89
|
+
if initial_grace && (Time.now - @initialized_at < initial_grace)
|
90
|
+
debug 'skipped initial grace'
|
91
|
+
return true
|
92
|
+
else
|
93
|
+
@options[:initial_grace] = nil
|
94
|
+
end
|
95
|
+
|
86
96
|
@value = get_value_safe
|
87
|
-
@
|
97
|
+
@good_value = good?(value)
|
98
|
+
@values << {:value => @value, :good => @good_value}
|
88
99
|
|
89
100
|
result = true
|
90
101
|
@check_count += 1
|
@@ -94,6 +105,14 @@ class Eye::Checker
|
|
94
105
|
result = false if bad_count >= min_tries
|
95
106
|
end
|
96
107
|
|
108
|
+
if skip_initial_fails
|
109
|
+
if @good_value
|
110
|
+
@options[:skip_initial_fails] = nil
|
111
|
+
else
|
112
|
+
result = true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
97
116
|
info "#{last_human_values} => #{result ? 'OK' : 'Fail'}"
|
98
117
|
result
|
99
118
|
|
data/lib/eye/system.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Makarchev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -371,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
371
371
|
version: 1.3.6
|
372
372
|
requirements: []
|
373
373
|
rubyforge_project:
|
374
|
-
rubygems_version: 2.
|
374
|
+
rubygems_version: 2.1.4
|
375
375
|
signing_key:
|
376
376
|
specification_version: 4
|
377
377
|
summary: Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI)
|