eye 0.8.pre2 → 0.8.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +141 -0
  3. data/.travis.yml +5 -3
  4. data/README.md +1 -2
  5. data/Rakefile +5 -5
  6. data/bin/leye +9 -4
  7. data/bin/loader_eye +14 -15
  8. data/examples/custom_check.eye +24 -0
  9. data/examples/custom_trigger.eye +3 -1
  10. data/examples/delayed_job.eye +3 -3
  11. data/examples/dependency.eye +10 -11
  12. data/examples/leye_example/Eyefile +10 -0
  13. data/examples/notify.eye +3 -4
  14. data/examples/plugin/main.eye +5 -5
  15. data/examples/plugin/plugin.rb +10 -2
  16. data/examples/process_thin.rb +8 -8
  17. data/examples/processes/em.rb +18 -12
  18. data/examples/processes/forking.rb +5 -5
  19. data/examples/processes/sample.rb +46 -44
  20. data/examples/puma.eye +9 -8
  21. data/examples/rbenv.eye +5 -5
  22. data/examples/sidekiq.eye +3 -3
  23. data/examples/stress_test.eye +4 -4
  24. data/examples/syslog.eye +1 -1
  25. data/examples/test.eye +1 -2
  26. data/examples/thin-farm.eye +7 -8
  27. data/examples/triggers.eye +13 -15
  28. data/examples/unicorn.eye +12 -13
  29. data/eye.gemspec +14 -12
  30. data/lib/eye.rb +2 -3
  31. data/lib/eye/application.rb +5 -6
  32. data/lib/eye/checker.rb +36 -19
  33. data/lib/eye/checker/children_count.rb +1 -1
  34. data/lib/eye/checker/file_ctime.rb +1 -1
  35. data/lib/eye/checker/http.rb +13 -15
  36. data/lib/eye/checker/nop.rb +1 -0
  37. data/lib/eye/checker/socket.rb +60 -63
  38. data/lib/eye/checker/ssl_socket.rb +5 -5
  39. data/lib/eye/child_process.rb +6 -4
  40. data/lib/eye/cli.rb +50 -41
  41. data/lib/eye/cli/commands.rb +4 -5
  42. data/lib/eye/cli/render.rb +61 -41
  43. data/lib/eye/cli/server.rb +19 -16
  44. data/lib/eye/client.rb +1 -0
  45. data/lib/eye/config.rb +19 -19
  46. data/lib/eye/controller.rb +2 -3
  47. data/lib/eye/controller/commands.rb +1 -1
  48. data/lib/eye/controller/helpers.rb +2 -2
  49. data/lib/eye/controller/load.rb +18 -12
  50. data/lib/eye/controller/options.rb +1 -5
  51. data/lib/eye/controller/send_command.rb +21 -23
  52. data/lib/eye/controller/status.rb +17 -15
  53. data/lib/eye/dsl.rb +3 -0
  54. data/lib/eye/dsl/application_opts.rb +4 -3
  55. data/lib/eye/dsl/chain.rb +2 -2
  56. data/lib/eye/dsl/child_process_opts.rb +3 -3
  57. data/lib/eye/dsl/config_opts.rb +7 -7
  58. data/lib/eye/dsl/group_opts.rb +3 -3
  59. data/lib/eye/dsl/helpers.rb +1 -1
  60. data/lib/eye/dsl/main.rb +4 -3
  61. data/lib/eye/dsl/opts.rb +31 -28
  62. data/lib/eye/dsl/process_opts.rb +13 -7
  63. data/lib/eye/dsl/pure_opts.rb +13 -9
  64. data/lib/eye/dsl/validation.rb +48 -35
  65. data/lib/eye/group.rb +20 -6
  66. data/lib/eye/group/chain.rb +6 -6
  67. data/lib/eye/loader.rb +1 -1
  68. data/lib/eye/local.rb +9 -4
  69. data/lib/eye/logger.rb +11 -4
  70. data/lib/eye/notify.rb +10 -6
  71. data/lib/eye/notify/jabber.rb +1 -1
  72. data/lib/eye/notify/mail.rb +2 -2
  73. data/lib/eye/notify/slack.rb +4 -3
  74. data/lib/eye/process.rb +2 -0
  75. data/lib/eye/process/children.rb +4 -4
  76. data/lib/eye/process/commands.rb +28 -31
  77. data/lib/eye/process/config.rb +21 -19
  78. data/lib/eye/process/data.rb +11 -9
  79. data/lib/eye/process/monitor.rb +30 -29
  80. data/lib/eye/process/notify.rb +10 -10
  81. data/lib/eye/process/scheduler.rb +36 -31
  82. data/lib/eye/process/states.rb +5 -4
  83. data/lib/eye/process/states_history.rb +9 -3
  84. data/lib/eye/process/system.rb +5 -4
  85. data/lib/eye/process/trigger.rb +1 -5
  86. data/lib/eye/process/watchers.rb +6 -9
  87. data/lib/eye/reason.rb +4 -1
  88. data/lib/eye/server.rb +2 -1
  89. data/lib/eye/system.rb +16 -13
  90. data/lib/eye/system_resources.rb +13 -8
  91. data/lib/eye/trigger.rb +18 -16
  92. data/lib/eye/trigger/check_dependency.rb +7 -4
  93. data/lib/eye/trigger/flapping.rb +24 -7
  94. data/lib/eye/trigger/starting_guard.rb +7 -6
  95. data/lib/eye/trigger/stop_children.rb +2 -2
  96. data/lib/eye/trigger/transition.rb +1 -1
  97. data/lib/eye/trigger/wait_dependency.rb +3 -2
  98. data/lib/eye/utils.rb +4 -3
  99. data/lib/eye/utils/alive_array.rb +9 -4
  100. data/lib/eye/utils/celluloid_chain.rb +12 -10
  101. data/lib/eye/utils/mini_active_support.rb +16 -16
  102. data/lib/eye/utils/pmap.rb +2 -0
  103. data/lib/eye/utils/tail.rb +2 -2
  104. metadata +34 -4
  105. data/lib/eye/utils/leak_19.rb +0 -10
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  Eye.app :syslog_test do
9
9
  process :some do
10
- pid_file "/tmp/syslog_test.pid"
10
+ pid_file '/tmp/syslog_test.pid'
11
11
  start_command "ruby -e 'loop { p Time.now; sleep 1 }'"
12
12
  daemonize!
13
13
  stdall syslog
@@ -66,7 +66,7 @@ Eye.application 'test' do
66
66
  end
67
67
 
68
68
  # eventmachine process, daemonized with eye
69
- process :event_machine do |p|
69
+ process :event_machine do
70
70
  pid_file 'em.pid'
71
71
  start_command 'ruby em.rb'
72
72
  stdout 'em.log'
@@ -86,5 +86,4 @@ Eye.application 'test' do
86
86
  check :http, url: 'http://127.0.0.1:33233/hello', pattern: /World/,
87
87
  every: 5.seconds, times: [2, 3], timeout: 1.second
88
88
  end
89
-
90
89
  end
@@ -1,30 +1,29 @@
1
1
  RUBY = 'ruby'
2
2
  BUNDLE = 'bundle'
3
3
 
4
- Eye.load("process_thin.rb")
4
+ Eye.load('process_thin.rb')
5
5
 
6
6
  Eye.config do
7
- logger "/tmp/eye.log"
7
+ logger '/tmp/eye.log'
8
8
  end
9
9
 
10
10
  Eye.app 'thin-farm' do
11
11
  working_dir File.expand_path(File.join(File.dirname(__FILE__), %w[ processes ]))
12
- env "RAILS_ENV" => "production"
12
+ env 'RAILS_ENV' => 'production'
13
13
 
14
14
  # more about stop_on_delete: https://github.com/kostya/eye/wiki/About-stop_on_delete-=-true
15
15
  stop_on_delete true
16
16
 
17
- trigger :flapping, :times => 10, :within => 1.minute
18
- check :memory, :below => 60.megabytes, :every => 30.seconds, :times => 5
17
+ trigger :flapping, times: 10, within: 1.minute
18
+ check :memory, below: 60.megabytes, every: 30.seconds, times: 5
19
19
  start_timeout 30.seconds
20
20
 
21
21
  group :web do
22
- chain :action => :restart, :grace => 5.seconds
23
- chain :action => :start, :grace => 0.2.seconds
22
+ chain action: :restart, grace: 5.seconds
23
+ chain action: :start, grace: 0.2.seconds
24
24
 
25
25
  (5555..5560).each do |port|
26
26
  thin self, port
27
27
  end
28
28
  end
29
-
30
29
  end
@@ -5,15 +5,14 @@
5
5
  # process.execute_sync(cmd, opts)
6
6
 
7
7
  Eye.config do
8
- logger "/tmp/eye.log"
8
+ logger '/tmp/eye.log'
9
9
  end
10
10
 
11
11
  Eye.app :triggers do
12
-
13
12
  # Execute shell command before process start
14
13
  process :a do
15
- pid_file "/tmp/a.pid"
16
- start_command "sleep 100"
14
+ pid_file '/tmp/a.pid'
15
+ start_command 'sleep 100'
17
16
  daemonize true
18
17
 
19
18
  # send message async which sendxmpp, before process start
@@ -24,41 +23,40 @@ Eye.app :triggers do
24
23
 
25
24
  # Touch some file before process start, remove file after process die
26
25
  process :b do
27
- pid_file "/tmp/b.pid"
28
- start_command "sleep 100"
26
+ pid_file '/tmp/b.pid'
27
+ start_command 'sleep 100'
29
28
  daemonize true
30
29
 
31
30
  # before process starting, touch some file
32
31
  trigger :transition1, to: :starting, do: -> {
33
- process.execute_sync "touch /tmp/bla.file"
32
+ process.execute_sync 'touch /tmp/bla.file'
34
33
  }
35
34
 
36
35
  # after process, crashed, or stopped, remove that file
37
36
  trigger :transition2, to: :down, do: -> {
38
- process.execute_sync "rm /tmp/bla.file"
37
+ process.execute_sync 'rm /tmp/bla.file'
39
38
  }
40
39
  end
41
40
 
42
41
  # With restart :c process, send restart to process :a
43
42
  process :c do
44
- pid_file "/tmp/c.pid"
45
- start_command "sleep 100"
43
+ pid_file '/tmp/c.pid'
44
+ start_command 'sleep 100'
46
45
  daemonize true
47
46
 
48
47
  app_name = app.name
49
- trigger :transition, :event => :restarting, :do => ->{
50
- info "send restarting to :a"
48
+ trigger :transition, event: :restarting, do: ->{
49
+ info 'send restarting to :a'
51
50
  Eye::Control.command('restart', "#{app_name}:a")
52
51
  }
53
52
  end
54
53
 
55
54
  # process d cant start, until file /tmp/bla contains string 'bla'
56
55
  process :d do
57
- pid_file "/tmp/d.pid"
58
- start_command "sleep 100"
56
+ pid_file '/tmp/d.pid'
57
+ start_command 'sleep 100'
59
58
  daemonize true
60
59
 
61
60
  trigger :starting_guard, every: 5.seconds, should: -> { `cat /tmp/bla` =~ /bla/ }
62
61
  end
63
-
64
62
  end
@@ -3,37 +3,36 @@
3
3
  RUBY = '/usr/local/ruby/1.9.3/bin/ruby' # ruby on the server
4
4
  RAILS_ENV = 'production'
5
5
 
6
- Eye.application "rails_unicorn" do
7
- env "RAILS_ENV" => RAILS_ENV
6
+ Eye.application 'rails_unicorn' do
7
+ env 'RAILS_ENV' => RAILS_ENV
8
8
 
9
9
  # unicorn requires to be `ruby` in path (for soft restart)
10
- env "PATH" => "#{File.dirname(RUBY)}:#{ENV['PATH']}"
10
+ env 'PATH' => "#{File.dirname(RUBY)}:#{ENV['PATH']}"
11
11
 
12
12
  working_dir File.expand_path(File.join(File.dirname(__FILE__), %w[ processes ]))
13
13
 
14
- process("unicorn") do
15
- pid_file "tmp/pids/unicorn.pid"
14
+ process('unicorn') do
15
+ pid_file 'tmp/pids/unicorn.pid'
16
16
  start_command "#{RUBY} ./bin/unicorn -Dc ./config/unicorn.rb -E #{RAILS_ENV}"
17
- stdall "log/unicorn.log"
17
+ stdall 'log/unicorn.log'
18
18
 
19
19
  # stop signals:
20
20
  # http://unicorn.bogomips.org/SIGNALS.html
21
21
  stop_signals [:TERM, 10.seconds]
22
22
 
23
23
  # soft restart
24
- restart_command "kill -USR2 {PID}"
24
+ restart_command 'kill -USR2 {PID}'
25
25
 
26
- check :cpu, :every => 30, :below => 80, :times => 3
27
- check :memory, :every => 30, :below => 150.megabytes, :times => [3,5]
26
+ check :cpu, every: 30, below: 80, times: 3
27
+ check :memory, every: 30, below: 150.megabytes, times: [3, 5]
28
28
 
29
29
  start_timeout 100.seconds
30
30
  restart_grace 30.seconds
31
31
 
32
32
  monitor_children do
33
- stop_command "kill -QUIT {PID}"
34
- check :cpu, :every => 30, :below => 80, :times => 3
35
- check :memory, :every => 30, :below => 150.megabytes, :times => [3,5]
33
+ stop_command 'kill -QUIT {PID}'
34
+ check :cpu, every: 30, below: 80, times: 3
35
+ check :memory, every: 30, below: 150.megabytes, times: [3, 5]
36
36
  end
37
37
  end
38
-
39
38
  end
@@ -1,20 +1,20 @@
1
1
  require File.expand_path('../lib/eye', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
- gem.authors = "Konstantin Makarchev"
5
- gem.email = "eye-rb@googlegroups.com"
4
+ gem.authors = 'Konstantin Makarchev'
5
+ gem.email = 'eye-rb@googlegroups.com'
6
6
 
7
7
  gem.description = gem.summary = \
8
- %q{Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI) >= 1.9.3-p194. Uses Celluloid and Celluloid::IO.}
9
- gem.homepage = "http://github.com/kostya/eye"
8
+ 'Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI) >= 1.9.3-p194. Uses Celluloid and Celluloid::IO.'
9
+ gem.homepage = 'http://github.com/kostya/eye'
10
10
 
11
- gem.files = `git ls-files`.split($\).reject{|n| n =~ %r[png|gif\z]}.reject{|n| n =~ %r[^(test|spec|features)/]}
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- #gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "eye"
15
- gem.require_paths = ["lib"]
11
+ gem.files = `git ls-files`.split($\).reject { |n| n =~ %r[png|gif\z] }.reject { |n| n =~ %r[^(test|spec|features)/] }
12
+ gem.executables = gem.files.grep(%r[^bin/]).map { |f| File.basename(f) }
13
+ # gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = 'eye'
15
+ gem.require_paths = ['lib']
16
16
  gem.version = Eye::VERSION
17
- gem.license = "MIT"
17
+ gem.license = 'MIT'
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9.2'
20
20
  gem.required_rubygems_version = '>= 1.3.6'
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_dependency 'celluloid-io', '~> 0.17.0'
24
24
  gem.add_dependency 'state_machine'
25
25
  gem.add_dependency 'thor'
26
- gem.add_dependency 'sigar', '~> 0.7.3'
26
+ gem.add_dependency 'sigar', '~> 0.7.3'
27
27
 
28
28
  gem.add_development_dependency 'rake'
29
29
  gem.add_development_dependency 'rspec', '< 2.14'
@@ -31,13 +31,15 @@ Gem::Specification.new do |gem|
31
31
  gem.add_development_dependency 'ruby-graphviz'
32
32
  gem.add_development_dependency 'forking'
33
33
  gem.add_development_dependency 'fakeweb'
34
- gem.add_development_dependency 'eventmachine', ">= 1.0.3"
34
+ gem.add_development_dependency 'eventmachine', '>= 1.0.3'
35
35
  gem.add_development_dependency 'sinatra'
36
36
  gem.add_development_dependency 'thin'
37
37
  gem.add_development_dependency 'xmpp4r'
38
38
  gem.add_development_dependency 'slack-notifier'
39
39
  gem.add_development_dependency 'coveralls'
40
+ gem.add_development_dependency 'tins', '1.6.0' # for coveralls
40
41
  gem.add_development_dependency 'simplecov', '>= 0.8.1'
41
42
  gem.add_development_dependency 'parallel_tests', '<= 1.3.1'
42
43
  gem.add_development_dependency 'parallel_split_test'
44
+ gem.add_development_dependency 'rubocop'
43
45
  end
data/lib/eye.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eye
2
- VERSION = "0.8.pre2"
2
+ VERSION = '0.8.rc'
3
3
  ABOUT = "Eye v#{VERSION} (c) 2012-2015 @kostya"
4
4
  PROCLINE = "eye monitoring v#{VERSION}"
5
5
 
@@ -8,7 +8,7 @@ module Eye
8
8
  autoload :Server, 'eye/server'
9
9
  autoload :Logger, 'eye/logger'
10
10
  autoload :System, 'eye/system'
11
- autoload :SystemResources,'eye/system_resources'
11
+ autoload :SystemResources, 'eye/system_resources'
12
12
  autoload :Checker, 'eye/checker'
13
13
  autoload :Trigger, 'eye/trigger'
14
14
  autoload :Group, 'eye/group'
@@ -21,7 +21,6 @@ module Eye
21
21
  autoload :Config, 'eye/config'
22
22
  autoload :Reason, 'eye/reason'
23
23
  autoload :Sigar, 'eye/sigar'
24
-
25
24
  autoload :Controller, 'eye/controller'
26
25
  autoload :Control, 'eye/control'
27
26
  autoload :Cli, 'eye/cli'
@@ -21,13 +21,12 @@ class Eye::Application
21
21
  @groups << group
22
22
  end
23
23
 
24
- # sort processes in name order
25
24
  def resort_groups
26
- @groups = @groups.sort { |a, b| a.hidden ? 1 : (b.hidden ? -1 : (a.name <=> b.name)) }
25
+ @groups.sort! # used group method <=> to compare
27
26
  end
28
27
 
29
- def status_data(debug = false)
30
- h = { name: @name, type: :application, subtree: @groups.map{|gr| gr.status_data(debug) }}
28
+ def status_data(opts = {})
29
+ h = { name: @name, type: :application, subtree: @groups.map { |gr| gr.status_data(opts) } }
31
30
  h[:debug] = debug_data if debug
32
31
  h
33
32
  end
@@ -53,13 +52,13 @@ class Eye::Application
53
52
 
54
53
  def sub_object?(obj)
55
54
  res = @groups.include?(obj)
56
- res = @groups.any?{|gr| gr.sub_object?(obj)} if !res
55
+ res = @groups.any? { |gr| gr.sub_object?(obj) } unless res
57
56
  res
58
57
  end
59
58
 
60
59
  def processes
61
60
  out = []
62
- @groups.each{|gr| out += gr.processes.to_a }
61
+ @groups.each { |gr| out += gr.processes.to_a }
63
62
  Eye::Utils::AliveArray.new(out)
64
63
  end
65
64
 
@@ -1,4 +1,5 @@
1
1
  class Eye::Checker
2
+
2
3
  include Eye::Dsl::Validation
3
4
 
4
5
  autoload :Memory, 'eye/checker/memory'
@@ -6,35 +7,35 @@ class Eye::Checker
6
7
  autoload :Http, 'eye/checker/http'
7
8
  autoload :FileCTime, 'eye/checker/file_ctime'
8
9
  autoload :FileSize, 'eye/checker/file_size'
9
- autoload :FileTouched,'eye/checker/file_touched'
10
+ autoload :FileTouched, 'eye/checker/file_touched'
10
11
  autoload :Socket, 'eye/checker/socket'
11
12
  autoload :SslSocket, 'eye/checker/ssl_socket'
12
13
  autoload :Nop, 'eye/checker/nop'
13
14
  autoload :Runtime, 'eye/checker/runtime'
14
15
  autoload :Cputime, 'eye/checker/cputime'
15
16
  autoload :ChildrenCount, 'eye/checker/children_count'
16
- autoload :ChildrenMemory,'eye/checker/children_memory'
17
+ autoload :ChildrenMemory, 'eye/checker/children_memory'
17
18
 
18
- TYPES = {:memory => 'Memory', :cpu => 'Cpu', :http => 'Http',
19
- :ctime => 'FileCTime', :fsize => 'FileSize', :file_touched => 'FileTouched',
20
- :socket => 'Socket', :nop => 'Nop', :runtime => 'Runtime', :cputime => 'Cputime',
21
- :children_count => "ChildrenCount", :children_memory => "ChildrenMemory", :ssl_socket => 'SslSocket' }
19
+ TYPES = { memory: 'Memory', cpu: 'Cpu', http: 'Http',
20
+ ctime: 'FileCTime', fsize: 'FileSize', file_touched: 'FileTouched',
21
+ socket: 'Socket', nop: 'Nop', runtime: 'Runtime', cputime: 'Cputime',
22
+ children_count: 'ChildrenCount', children_memory: 'ChildrenMemory', ssl_socket: 'SslSocket' }
22
23
 
23
24
  attr_accessor :value, :values, :options, :pid, :type, :check_count, :process
24
25
 
25
26
  param :every, [Fixnum, Float], false, 5
26
27
  param :times, [Fixnum, Array], nil, 1
27
- param :fires, [Symbol, Array], nil, nil, [:stop, :restart, :unmonitor, :start, :delete, :nothing, :notify]
28
+ param :fires, [Symbol, Array, Proc], nil, nil, [:stop, :restart, :unmonitor, :start, :delete, :nothing, :notify]
28
29
  param :initial_grace, [Fixnum, Float]
29
30
  param :skip_initial_fails, [TrueClass, FalseClass]
30
31
 
31
32
  def self.name_and_class(type)
32
33
  type = type.to_sym
33
- return {:name => type, :type => type} if TYPES[type]
34
+ return { name: type, type: type } if TYPES[type]
34
35
 
35
- if type =~ /\A(.*?)_?[0-9]+\z/
36
- ctype = $1.to_sym
37
- return {:name => type, :type => ctype} if TYPES[ctype]
36
+ if type =~ %r[\A(.*?)_?[0-9]+\z]
37
+ ctype = Regexp.last_match(1).to_sym
38
+ return { name: type, type: ctype } if TYPES[ctype]
38
39
  end
39
40
  end
40
41
 
@@ -50,7 +51,7 @@ class Eye::Checker
50
51
  def self.create(pid, options = {}, process = nil)
51
52
  get_class(options[:type]).new(pid, options, process)
52
53
 
53
- rescue Exception, Timeout::Error => ex
54
+ rescue Object => ex
54
55
  log_ex(ex)
55
56
  nil
56
57
  end
@@ -79,11 +80,11 @@ class Eye::Checker
79
80
  end
80
81
 
81
82
  def logger_tag
82
- @process.logger.prefix if @process
83
+ @logger_tag ||= @process ? @process.logger.prefix : nil
83
84
  end
84
85
 
85
86
  def logger_sub_tag
86
- "check:#{check_name}"
87
+ @logger_sub_tag ||= "check:#{check_name}"
87
88
  end
88
89
 
89
90
  def last_human_values
@@ -105,13 +106,13 @@ class Eye::Checker
105
106
 
106
107
  @value = get_value_safe
107
108
  @good_value = good?(value)
108
- @values << {:value => @value, :good => @good_value}
109
+ @values << { value: @value, good: @good_value }
109
110
 
110
111
  result = true
111
112
  @check_count += 1
112
113
 
113
114
  if @values.size == max_tries
114
- bad_count = @values.count{|v| !v[:good] }
115
+ bad_count = @values.count { |v| !v[:good] }
115
116
  result = false if bad_count >= min_tries
116
117
  end
117
118
 
@@ -126,7 +127,7 @@ class Eye::Checker
126
127
  info "#{last_human_values} => #{result ? 'OK' : 'Fail'}"
127
128
  result
128
129
 
129
- rescue Exception, Timeout::Error => ex
130
+ rescue Object => ex
130
131
  log_ex(ex)
131
132
  end
132
133
 
@@ -189,7 +190,12 @@ class Eye::Checker
189
190
  process.notify :warn, "Bounded #{check_name}: #{last_human_values} send to #{actions}"
190
191
 
191
192
  actions.each do |action|
192
- process.schedule action, Eye::Reason.new("bounded #{check_name}")
193
+ reason = Eye::Reason.new("bounded #{check_name}")
194
+ if action.is_a?(Proc)
195
+ process.schedule :execute_proc, reason, &action
196
+ else
197
+ process.schedule action, reason
198
+ end
193
199
  end
194
200
  end
195
201
 
@@ -198,9 +204,11 @@ class Eye::Checker
198
204
  end
199
205
 
200
206
  class Defer < Eye::Checker
207
+
201
208
  def get_value_safe
202
- Celluloid::Future.new{ get_value }.value
209
+ Celluloid::Future.new { get_value }.value
203
210
  end
211
+
204
212
  end
205
213
 
206
214
  def self.register(base)
@@ -214,27 +222,34 @@ class Eye::Checker
214
222
  end
215
223
 
216
224
  class CustomCell < Eye::Checker
225
+
217
226
  def self.inherited(base)
218
227
  super
219
228
  register(base)
220
229
  end
230
+
221
231
  end
222
232
 
223
233
  class Custom < Defer
234
+
224
235
  def self.inherited(base)
225
236
  super
226
237
  register(base)
227
238
  end
239
+
228
240
  end
229
241
 
230
242
  class CustomDefer < Defer
243
+
231
244
  def self.inherited(base)
232
245
  super
233
246
  register(base)
234
247
  end
248
+
235
249
  end
236
250
 
237
251
  class Measure < Eye::Checker
252
+
238
253
  param :below, [Fixnum, Float]
239
254
  param :above, [Fixnum, Float]
240
255
 
@@ -255,5 +270,7 @@ class Eye::Checker
255
270
  '-'
256
271
  end
257
272
  end
273
+
258
274
  end
275
+
259
276
  end