eye 0.4.1 → 0.4.2

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: a1b6bc63e403f70e9de31aeedabd8712ed291fbf
4
- data.tar.gz: 9c0d9241079bd13bff558852a5cd71c404f1b50e
3
+ metadata.gz: 4cc2e7aadccf1d14e140a5973af361dbb08095e9
4
+ data.tar.gz: 2a893e150885625c221d598f9a0dcddf4040e076
5
5
  SHA512:
6
- metadata.gz: c86cba4c4a63f6febe9bad36d7f4696f766a8695129eef747518b2edad3e48a48d2d13523ba65d92ea8b346446cf50976e7b2e45ee3c143e5b4a1ce617880605
7
- data.tar.gz: 5f760e64c45443a4429a127736770a1f66a31d61b56347c69c61242fdf7f28b427f0d995af0b5dd054c327bf99422150b9ee9033dde04fcce06b73143062451d
6
+ metadata.gz: 8e97e29338ad7de4c16f4c36b599f911625431b0680e96a523e04b8ba8046730270b80af718b55d323c2524952477a876f3e097be67ee3ecf3d1cf1ec4b3c18f
7
+ data.tar.gz: f284102b968e833691aab4cccac606f6bb2815dbcc9514203ac687f607c2603e8f12b0e18cb3daddbf09569e217d1e9c6ae4ad86232a63e5c32a10958eb5b1dc
data/CHANGES.md CHANGED
@@ -1,4 +1,9 @@
1
- 0.4.1.dev
1
+ 0.4.2
2
+ -----
3
+ * add checker options :initial_grace, :skip_initial_fails
4
+ * allow deleting env variables (#15)
5
+
6
+ 0.4.1
2
7
  ---------
3
8
  * add nop checker for periodic restart
4
9
  * catch errors in custom checkers, triggers
data/lib/eye.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eye
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  ABOUT = "Eye v#{VERSION} (c) 2012-2013 @kostya"
4
4
  PROCLINE = "eye monitoring v#{VERSION}"
5
5
 
@@ -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
- @values << {:value => @value, :good => good?(value)}
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
 
@@ -156,7 +156,7 @@ module Eye::System
156
156
  env = {}
157
157
 
158
158
  (config[:environment] || {}).each do |k,v|
159
- env[k.to_s] = v.to_s if v
159
+ env[k.to_s] = v && v.to_s
160
160
  end
161
161
 
162
162
  env
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.1
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-08-31 00:00:00.000000000 Z
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.0.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)