eye 0.2.4 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/bin/eye +7 -0
- data/bin/loader_eye +7 -5
- data/examples/notify.eye +1 -1
- data/eye.gemspec +4 -4
- data/lib/eye.rb +1 -3
- data/lib/eye/controller.rb +4 -0
- data/lib/eye/controller/status.rb +1 -1
- data/lib/eye/dsl.rb +1 -1
- data/lib/eye/dsl/main.rb +0 -13
- data/lib/eye/dsl/opts.rb +4 -2
- data/lib/eye/loader.rb +2 -3
- data/lib/eye/notify.rb +3 -3
- data/lib/eye/process/monitor.rb +5 -3
- data/lib/eye/process/notify.rb +5 -5
- data/lib/eye/process/scheduler.rb +4 -4
- data/lib/eye/process/system.rb +3 -10
- data/lib/eye/process/trigger.rb +1 -1
- data/lib/eye/process/watchers.rb +1 -1
- data/lib/eye/server.rb +9 -8
- data/lib/eye/system.rb +2 -7
- data/lib/eye/system_resources.rb +3 -3
- data/lib/eye/utils/celluloid_chain.rb +2 -2
- metadata +7 -241
- data/lib/eye/io/unix_server.rb +0 -44
- data/lib/eye/io/unix_socket.rb +0 -39
- data/spec/checker/cpu_spec.rb +0 -58
- data/spec/checker/file_ctime_spec.rb +0 -34
- data/spec/checker/file_size_spec.rb +0 -107
- data/spec/checker/http_spec.rb +0 -114
- data/spec/checker/memory_spec.rb +0 -64
- data/spec/checker/socket_spec.rb +0 -116
- data/spec/checker_spec.rb +0 -187
- data/spec/child_process/child_process_spec.rb +0 -46
- data/spec/client_server_spec.rb +0 -33
- data/spec/controller/commands_spec.rb +0 -92
- data/spec/controller/controller_spec.rb +0 -157
- data/spec/controller/find_objects_spec.rb +0 -176
- data/spec/controller/group_spec.rb +0 -110
- data/spec/controller/intergration_spec.rb +0 -366
- data/spec/controller/load_spec.rb +0 -371
- data/spec/controller/races_spec.rb +0 -70
- data/spec/controller/stop_on_delete_spec.rb +0 -157
- data/spec/dsl/chain_spec.rb +0 -146
- data/spec/dsl/checks_spec.rb +0 -219
- data/spec/dsl/config_spec.rb +0 -44
- data/spec/dsl/dsl_spec.rb +0 -73
- data/spec/dsl/getter_spec.rb +0 -223
- data/spec/dsl/integration_spec.rb +0 -376
- data/spec/dsl/load_spec.rb +0 -52
- data/spec/dsl/notify_spec.rb +0 -114
- data/spec/dsl/process_spec.rb +0 -380
- data/spec/dsl/sub_procs_spec.rb +0 -93
- data/spec/dsl/with_server_spec.rb +0 -128
- data/spec/example/em.rb +0 -57
- data/spec/example/forking.rb +0 -20
- data/spec/example/sample.rb +0 -154
- data/spec/fixtures/dsl/0.rb +0 -8
- data/spec/fixtures/dsl/0a.rb +0 -8
- data/spec/fixtures/dsl/0c.rb +0 -8
- data/spec/fixtures/dsl/1.rb +0 -5
- data/spec/fixtures/dsl/bad.eye +0 -6
- data/spec/fixtures/dsl/configs/1.eye +0 -3
- data/spec/fixtures/dsl/configs/2.eye +0 -1
- data/spec/fixtures/dsl/configs/3.eye +0 -1
- data/spec/fixtures/dsl/configs/4.eye +0 -3
- data/spec/fixtures/dsl/empty.eye +0 -20
- data/spec/fixtures/dsl/include_test.eye +0 -5
- data/spec/fixtures/dsl/include_test/1.rb +0 -6
- data/spec/fixtures/dsl/include_test/ha.rb +0 -4
- data/spec/fixtures/dsl/include_test2.eye +0 -5
- data/spec/fixtures/dsl/integration.eye +0 -30
- data/spec/fixtures/dsl/integration2.eye +0 -32
- data/spec/fixtures/dsl/integration_locks.eye +0 -30
- data/spec/fixtures/dsl/integration_sor.eye +0 -32
- data/spec/fixtures/dsl/integration_sor2.eye +0 -27
- data/spec/fixtures/dsl/integration_sor3.eye +0 -32
- data/spec/fixtures/dsl/load.eye +0 -25
- data/spec/fixtures/dsl/load2.eye +0 -7
- data/spec/fixtures/dsl/load2_dup2.eye +0 -13
- data/spec/fixtures/dsl/load2_dup_pid.eye +0 -7
- data/spec/fixtures/dsl/load3.eye +0 -10
- data/spec/fixtures/dsl/load4.eye +0 -7
- data/spec/fixtures/dsl/load5.eye +0 -8
- data/spec/fixtures/dsl/load6.eye +0 -17
- data/spec/fixtures/dsl/load_dubls.eye +0 -36
- data/spec/fixtures/dsl/load_dup_ex_names.eye +0 -15
- data/spec/fixtures/dsl/load_error.eye +0 -5
- data/spec/fixtures/dsl/load_error_folder/load3.eye +0 -10
- data/spec/fixtures/dsl/load_error_folder/load4.eye +0 -7
- data/spec/fixtures/dsl/load_folder/load3.eye +0 -10
- data/spec/fixtures/dsl/load_folder/load4.eye +0 -7
- data/spec/fixtures/dsl/load_int.eye +0 -8
- data/spec/fixtures/dsl/load_int2.eye +0 -13
- data/spec/fixtures/dsl/load_logger.eye +0 -26
- data/spec/fixtures/dsl/load_logger2.eye +0 -3
- data/spec/fixtures/dsl/long_load.eye +0 -5
- data/spec/fixtures/dsl/subfolder1/proc1.rb +0 -3
- data/spec/fixtures/dsl/subfolder2.eye +0 -9
- data/spec/fixtures/dsl/subfolder2/common.rb +0 -1
- data/spec/fixtures/dsl/subfolder2/proc2.rb +0 -3
- data/spec/fixtures/dsl/subfolder2/sub/proc3.rb +0 -6
- data/spec/fixtures/dsl/subfolder3.eye +0 -8
- data/spec/fixtures/dsl/subfolder3/common.rb +0 -1
- data/spec/fixtures/dsl/subfolder3/proc4.rb +0 -3
- data/spec/fixtures/dsl/subfolder3/sub/proc5.rb +0 -6
- data/spec/fixtures/dsl/subfolder4.eye +0 -6
- data/spec/fixtures/dsl/subfolder4/a.rb +0 -2
- data/spec/fixtures/dsl/subfolder4/b.rb +0 -1
- data/spec/fixtures/dsl/subfolder4/c.rb +0 -1
- data/spec/mock_spec.rb +0 -31
- data/spec/notify/jabber_spec.rb +0 -25
- data/spec/notify/mail_spec.rb +0 -26
- data/spec/notify_spec.rb +0 -90
- data/spec/process/checks/child_checks_spec.rb +0 -79
- data/spec/process/checks/cpu_spec.rb +0 -114
- data/spec/process/checks/ctime_spec.rb +0 -43
- data/spec/process/checks/fsize_spec.rb +0 -22
- data/spec/process/checks/http_spec.rb +0 -52
- data/spec/process/checks/intergration_spec.rb +0 -32
- data/spec/process/checks/memory_spec.rb +0 -127
- data/spec/process/child_process_spec.rb +0 -125
- data/spec/process/config_spec.rb +0 -74
- data/spec/process/controller_spec.rb +0 -173
- data/spec/process/monitoring_spec.rb +0 -180
- data/spec/process/notify_spec.rb +0 -27
- data/spec/process/restart_spec.rb +0 -186
- data/spec/process/scheduler_spec.rb +0 -178
- data/spec/process/start_spec.rb +0 -261
- data/spec/process/states_history_spec.rb +0 -123
- data/spec/process/stop_spec.rb +0 -156
- data/spec/process/system_spec.rb +0 -136
- data/spec/process/triggers/flapping_spec.rb +0 -242
- data/spec/process/update_config_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -128
- data/spec/support/rr_celluloid.rb +0 -15
- data/spec/support/spec_support.rb +0 -163
- data/spec/system_resources_spec.rb +0 -56
- data/spec/system_spec.rb +0 -174
- data/spec/utils/alive_array_spec.rb +0 -49
- data/spec/utils/celluloid_chain_spec.rb +0 -89
- data/spec/utils/tail_spec.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae0406a7f4bd886b167c02a54f60eed9c31c1f50
|
4
|
+
data.tar.gz: 37f991e3ab296e74f568ea84c40e6b57d9240ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0fca55046216067bc3a924a3526d1e483f8aceef3a72bac53462978f35df794fd2a4bbfe0e776f989273abb5f8709b7c676302caeffe098c1b6dd07955ccd65
|
7
|
+
data.tar.gz: 5311297341068796e16ae6e13035fbbde98b71891caa3738229bafa7f3762a88c97839b71ecae890f4fb114ef6d60b5aec6f8dfa119e4c7b2ac80f104154ea82
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
Eye
|
1
|
+
Eye [![Build Status](https://secure.travis-ci.org/kostya/eye.png?branch=master)](http://travis-ci.org/kostya/eye)
|
2
2
|
===
|
3
3
|
|
4
|
-
[![Build Status](https://secure.travis-ci.org/kostya/eye.png?branch=master)](http://travis-ci.org/kostya/eye)
|
5
|
-
|
6
4
|
Process monitoring tool. An alternative to God and Bluepill. With Bluepill like config syntax. Requires MRI Ruby >= 1.9.2. Uses Celluloid and Celluloid::IO.
|
7
5
|
|
8
6
|
Little demo, shows general commands and how chain works:
|
data/bin/eye
CHANGED
@@ -132,6 +132,13 @@ class Cli < Thor
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
desc "watch [MASK]", "interactive process info"
|
136
|
+
def watch(*args)
|
137
|
+
pid = Process.spawn("watch -n 1 --color #{$0} i #{args * ' '}")
|
138
|
+
Process.waitpid(pid)
|
139
|
+
rescue Interrupt
|
140
|
+
end
|
141
|
+
|
135
142
|
private
|
136
143
|
|
137
144
|
def client
|
data/bin/loader_eye
CHANGED
@@ -40,6 +40,9 @@ Eye::Logger.link_logger(options[:logger]) if options[:logger]
|
|
40
40
|
|
41
41
|
config = options[:config]
|
42
42
|
config = File.expand_path(config) if config && !config.empty?
|
43
|
+
|
44
|
+
Eye::Control # preload
|
45
|
+
|
43
46
|
if config
|
44
47
|
res = server.command('load', config)
|
45
48
|
exit if res[:error]
|
@@ -47,10 +50,9 @@ end
|
|
47
50
|
|
48
51
|
Eye::Control.set_proc_line
|
49
52
|
|
50
|
-
server.run
|
53
|
+
server.async.run
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
+
trap("INT"){ exit }
|
56
|
+
trap("USR2"){ GC.start }
|
55
57
|
|
56
|
-
sleep
|
58
|
+
sleep
|
data/examples/notify.eye
CHANGED
data/eye.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
|
|
8
8
|
%q{Process monitoring tool. An alternative to God and Bluepill. With Bluepill like config syntax. Requires MRI Ruby >= 1.9.2. Uses Celluloid and Celluloid::IO.}
|
9
9
|
gem.homepage = "http://github.com/kostya/eye"
|
10
10
|
|
11
|
-
gem.files = `git ls-files`.split($\).reject{|n| n =~ %r[png|gif\z]}
|
11
|
+
gem.files = `git ls-files`.split($\).reject{|n| n =~ %r[png|gif\z]}.reject{|n| n =~ %r[^(test|spec|features)/]}
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
+
#gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "eye"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Eye::VERSION
|
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.required_ruby_version = '>= 1.9.2' # because of celluloid
|
20
20
|
gem.required_rubygems_version = '>= 1.3.6'
|
21
21
|
|
22
|
-
gem.add_dependency 'celluloid', '~> 0.
|
23
|
-
gem.add_dependency 'celluloid-io', '~> 0.
|
22
|
+
gem.add_dependency 'celluloid', '~> 0.13.0'
|
23
|
+
gem.add_dependency 'celluloid-io', '~> 0.13.0'
|
24
24
|
gem.add_dependency 'state_machine', '< 1.2'
|
25
25
|
gem.add_dependency 'activesupport', '~> 3.2.0'
|
26
26
|
gem.add_dependency 'thor'
|
data/lib/eye.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Eye
|
2
|
-
VERSION = "0.
|
2
|
+
VERSION = "0.3"
|
3
3
|
ABOUT = "Eye v#{VERSION} (c) 2012-2013 @kostya"
|
4
4
|
|
5
5
|
autoload :Process, 'eye/process'
|
@@ -21,5 +21,3 @@ module Eye
|
|
21
21
|
autoload :Controller, 'eye/controller'
|
22
22
|
autoload :Control, 'eye/control'
|
23
23
|
end
|
24
|
-
|
25
|
-
ENV_LANG = ENV['LANG'] # save original LANG, bug of celluloid 0.12
|
data/lib/eye/controller.rb
CHANGED
data/lib/eye/dsl.rb
CHANGED
data/lib/eye/dsl/main.rb
CHANGED
@@ -41,18 +41,5 @@ module Eye::Dsl::Main
|
|
41
41
|
|
42
42
|
Eye::Dsl.debug "<= config"
|
43
43
|
end
|
44
|
-
|
45
|
-
def logger=(log_path)
|
46
|
-
STDERR.puts "Eye.logger= is deprecated!"
|
47
|
-
@parsed_config ||= {}
|
48
|
-
@parsed_config[:config] ||= {}
|
49
|
-
@parsed_config[:config][:logger] = log_path
|
50
|
-
end
|
51
44
|
|
52
|
-
def logger_level=(log_level)
|
53
|
-
STDERR.puts "Eye.logger_level= is deprecated!"
|
54
|
-
@parsed_config ||= {}
|
55
|
-
@parsed_config[:config] ||= {}
|
56
|
-
@parsed_config[:config][:logger_level] = log_level
|
57
|
-
end
|
58
45
|
end
|
data/lib/eye/dsl/opts.rb
CHANGED
@@ -65,8 +65,10 @@ class Eye::Dsl::Opts < Eye::Dsl::PureOpts
|
|
65
65
|
@config[:triggers].try :delete, type
|
66
66
|
end
|
67
67
|
|
68
|
-
def notify(contact, level = :
|
69
|
-
|
68
|
+
def notify(contact, level = :warn)
|
69
|
+
unless Eye::Process::Notify::LEVELS[level]
|
70
|
+
raise Eye::Dsl::Error, "level should be in #{Eye::Process::Notify::LEVELS.keys}"
|
71
|
+
end
|
70
72
|
|
71
73
|
@config[:notify] ||= {}
|
72
74
|
@config[:notify][contact.to_s] = level
|
data/lib/eye/loader.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# mini bundler, for embedded server gem installation
|
2
2
|
|
3
|
-
gem 'celluloid', '~> 0.
|
4
|
-
gem 'celluloid-io', '~> 0.
|
3
|
+
gem 'celluloid', '~> 0.13.0'
|
4
|
+
gem 'celluloid-io', '~> 0.13.0'
|
5
5
|
gem 'nio4r'
|
6
|
-
gem 'facter'
|
7
6
|
gem 'timers'
|
8
7
|
|
9
8
|
gem 'state_machine', '< 1.2'
|
data/lib/eye/notify.rb
CHANGED
@@ -19,14 +19,14 @@ class Eye::Notify
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.notify(contact, message_h)
|
22
|
-
|
23
|
-
needed_hash = (
|
22
|
+
self_config = Eye::Control.self_config
|
23
|
+
needed_hash = (self_config[:contacts] || {})[contact.to_s]
|
24
24
|
|
25
25
|
return if needed_hash.blank?
|
26
26
|
|
27
27
|
create_proc = lambda do |nh|
|
28
28
|
type = nh[:type]
|
29
|
-
config = (
|
29
|
+
config = (self_config[type] || {}).merge(nh[:opts] || {}).merge(:contact => nh[:contact])
|
30
30
|
klass = get_class(type)
|
31
31
|
notify = klass.new(config, message_h)
|
32
32
|
notify.async_notify if notify
|
data/lib/eye/process/monitor.rb
CHANGED
@@ -39,7 +39,7 @@ private
|
|
39
39
|
# check that process runned
|
40
40
|
unless process_realy_running?
|
41
41
|
warn "check_alive: process(#{self.pid}) not found!"
|
42
|
-
notify :
|
42
|
+
notify :info, 'crashed!'
|
43
43
|
switch :crashed, 'crashed'
|
44
44
|
else
|
45
45
|
# check that pid_file still here
|
@@ -78,7 +78,7 @@ private
|
|
78
78
|
if down?
|
79
79
|
if self[:keep_alive]
|
80
80
|
warn 'check crashed: process is down'
|
81
|
-
schedule :
|
81
|
+
schedule :restore, 'crashed'
|
82
82
|
else
|
83
83
|
warn 'check crashed: process without keep_alive'
|
84
84
|
schedule :unmonitor, 'crashed'
|
@@ -88,6 +88,8 @@ private
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
|
91
|
+
def restore
|
92
|
+
start if down?
|
93
|
+
end
|
92
94
|
|
93
95
|
end
|
data/lib/eye/process/notify.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Eye::Process::Notify
|
2
2
|
|
3
3
|
# notify to user:
|
4
|
-
# 1) process crashed by itself, and we restart it [:
|
5
|
-
# 2) checker bounded to restart process [:
|
6
|
-
# 3) flapping + switch to unmonitored [:
|
4
|
+
# 1) process crashed by itself, and we restart it [:info]
|
5
|
+
# 2) checker bounded to restart process [:warn]
|
6
|
+
# 3) flapping + switch to unmonitored [:error]
|
7
7
|
|
8
|
-
LEVELS = {:
|
8
|
+
LEVELS = {:debug => 0, :info => 1, :warn => 2, :error => 3, :fatal => 4}
|
9
9
|
|
10
10
|
def notify(level, msg)
|
11
11
|
# logging it
|
12
|
-
error "NOTIFY: #{msg}" if ilevel(level) >
|
12
|
+
error "NOTIFY: #{msg}" if ilevel(level) > ilevel(:info)
|
13
13
|
|
14
14
|
# send notifies
|
15
15
|
if self[:notify].present?
|
@@ -44,9 +44,9 @@ module Eye::Process::Scheduler
|
|
44
44
|
def scheduler_actions_list
|
45
45
|
scheduler.list.map{|c| c[:args].first rescue nil }.compact
|
46
46
|
end
|
47
|
-
|
48
|
-
def
|
49
|
-
remove_scheduler
|
47
|
+
|
48
|
+
def self.included(base)
|
49
|
+
base.finalizer :remove_scheduler
|
50
50
|
end
|
51
51
|
|
52
52
|
attr_accessor :current_scheduled_command
|
@@ -61,7 +61,7 @@ private
|
|
61
61
|
def remove_scheduler
|
62
62
|
@scheduler.terminate if @scheduler && @scheduler.alive?
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def scheduler
|
66
66
|
@scheduler ||= Eye::Utils::CelluloidChain.new(current_actor)
|
67
67
|
end
|
data/lib/eye/process/system.rb
CHANGED
@@ -36,16 +36,9 @@ module Eye::Process::System
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def process_realy_running?
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
error "process_realy_running?: check_pid_alive returns '#{res[:error].message}'"
|
43
|
-
end
|
44
|
-
res[:result]
|
45
|
-
else
|
46
|
-
debug "process_realy_running?: called without pid"
|
47
|
-
nil
|
48
|
-
end
|
39
|
+
res = Eye::System.check_pid_alive(self.pid)
|
40
|
+
debug "process_realy_running?: (#{self.pid}) #{res.inspect}"
|
41
|
+
!!res[:result]
|
49
42
|
end
|
50
43
|
|
51
44
|
def send_signal(code)
|
data/lib/eye/process/trigger.rb
CHANGED
data/lib/eye/process/watchers.rb
CHANGED
@@ -61,7 +61,7 @@ private
|
|
61
61
|
return unless up?
|
62
62
|
|
63
63
|
action = subject.fire || :restart
|
64
|
-
notify :
|
64
|
+
notify :warn, "Bounded #{subject.check_name}: #{subject.last_human_values} send to :#{action}"
|
65
65
|
schedule action, "bounded #{subject.check_name}"
|
66
66
|
end
|
67
67
|
end
|
data/lib/eye/server.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'celluloid/io'
|
2
|
-
|
3
|
-
require_relative 'io/unix_server'
|
2
|
+
require 'celluloid/autostart'
|
4
3
|
|
5
4
|
class Eye::Server
|
6
5
|
include Celluloid::IO
|
@@ -16,14 +15,9 @@ class Eye::Server
|
|
16
15
|
UNIXServer.open(socket_path)
|
17
16
|
end
|
18
17
|
end
|
19
|
-
|
20
|
-
def finalize
|
21
|
-
@server.close if @server
|
22
|
-
unlink_socket_file
|
23
|
-
end
|
24
18
|
|
25
19
|
def run
|
26
|
-
loop { handle_connection
|
20
|
+
loop { async.handle_connection @server.accept }
|
27
21
|
end
|
28
22
|
|
29
23
|
def handle_connection(socket)
|
@@ -48,4 +42,11 @@ class Eye::Server
|
|
48
42
|
rescue
|
49
43
|
end
|
50
44
|
|
45
|
+
finalizer :close_socket
|
46
|
+
|
47
|
+
def close_socket
|
48
|
+
@server.close if @server
|
49
|
+
unlink_socket_file
|
50
|
+
end
|
51
|
+
|
51
52
|
end
|
data/lib/eye/system.rb
CHANGED
@@ -7,9 +7,8 @@ module Eye::System
|
|
7
7
|
# very fast
|
8
8
|
# return result hash
|
9
9
|
def check_pid_alive(pid)
|
10
|
-
res = if pid
|
10
|
+
res = if pid
|
11
11
|
::Process.kill(0, pid)
|
12
|
-
true
|
13
12
|
else
|
14
13
|
false
|
15
14
|
end
|
@@ -131,8 +130,7 @@ module Eye::System
|
|
131
130
|
end
|
132
131
|
|
133
132
|
def spawn_options(config = {})
|
134
|
-
o = {}
|
135
|
-
o = {chdir: config[:working_dir]} if config[:working_dir]
|
133
|
+
o = {pgroup: true, chdir: config[:working_dir] || '/'}
|
136
134
|
o.update(out: [config[:stdout], 'a']) if config[:stdout]
|
137
135
|
o.update(err: [config[:stderr], 'a']) if config[:stderr]
|
138
136
|
o.update(in: config[:stdin]) if config[:stdin]
|
@@ -146,9 +144,6 @@ module Eye::System
|
|
146
144
|
env[k.to_s] = v.to_s if v
|
147
145
|
end
|
148
146
|
|
149
|
-
# return original LANG env, because ruby loose it (needs for unicorn)
|
150
|
-
env['LANG'] = ENV_LANG unless env['LANG']
|
151
|
-
|
152
147
|
# set PWD for unicorn respawn
|
153
148
|
env['PWD'] = config[:working_dir] if config[:working_dir]
|
154
149
|
|
data/lib/eye/system_resources.rb
CHANGED
@@ -69,7 +69,7 @@ class Eye::SystemResources
|
|
69
69
|
def get
|
70
70
|
if @at + UPDATE_INTERVAL < Time.now
|
71
71
|
@at = Time.now # for minimize races
|
72
|
-
set
|
72
|
+
async.set
|
73
73
|
end
|
74
74
|
@ps_aux
|
75
75
|
end
|
@@ -77,10 +77,10 @@ class Eye::SystemResources
|
|
77
77
|
private
|
78
78
|
|
79
79
|
def set
|
80
|
-
@ps_aux =
|
80
|
+
@ps_aux = Eye::System.ps_aux
|
81
81
|
@at = Time.now
|
82
82
|
end
|
83
83
|
|
84
84
|
end
|
85
85
|
|
86
|
-
end
|
86
|
+
end
|
@@ -11,13 +11,13 @@ class Eye::Utils::CelluloidChain
|
|
11
11
|
|
12
12
|
def add(method_name, *args, &block)
|
13
13
|
@calls << {:method_name => method_name, :args => args, :block => block}
|
14
|
-
process
|
14
|
+
async.process unless @running
|
15
15
|
end
|
16
16
|
|
17
17
|
def add_wo_dups(method_name, *args, &block)
|
18
18
|
h = {:method_name => method_name, :args => args, :block => block}
|
19
19
|
@calls << h if @calls[-1] != h
|
20
|
-
process
|
20
|
+
async.process unless @running
|
21
21
|
end
|
22
22
|
|
23
23
|
def list
|
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
|
+
version: '0.3'
|
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-05-
|
11
|
+
date: 2013-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.13.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: celluloid-io
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.13.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.13.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: state_machine
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,8 +299,6 @@ files:
|
|
299
299
|
- lib/eye/dsl/validation.rb
|
300
300
|
- lib/eye/group.rb
|
301
301
|
- lib/eye/group/chain.rb
|
302
|
-
- lib/eye/io/unix_server.rb
|
303
|
-
- lib/eye/io/unix_socket.rb
|
304
302
|
- lib/eye/loader.rb
|
305
303
|
- lib/eye/logger.rb
|
306
304
|
- lib/eye/notify.rb
|
@@ -332,122 +330,6 @@ files:
|
|
332
330
|
- lib/eye/utils/celluloid_chain.rb
|
333
331
|
- lib/eye/utils/leak_19.rb
|
334
332
|
- lib/eye/utils/tail.rb
|
335
|
-
- spec/checker/cpu_spec.rb
|
336
|
-
- spec/checker/file_ctime_spec.rb
|
337
|
-
- spec/checker/file_size_spec.rb
|
338
|
-
- spec/checker/http_spec.rb
|
339
|
-
- spec/checker/memory_spec.rb
|
340
|
-
- spec/checker/socket_spec.rb
|
341
|
-
- spec/checker_spec.rb
|
342
|
-
- spec/child_process/child_process_spec.rb
|
343
|
-
- spec/client_server_spec.rb
|
344
|
-
- spec/controller/commands_spec.rb
|
345
|
-
- spec/controller/controller_spec.rb
|
346
|
-
- spec/controller/find_objects_spec.rb
|
347
|
-
- spec/controller/group_spec.rb
|
348
|
-
- spec/controller/intergration_spec.rb
|
349
|
-
- spec/controller/load_spec.rb
|
350
|
-
- spec/controller/races_spec.rb
|
351
|
-
- spec/controller/stop_on_delete_spec.rb
|
352
|
-
- spec/dsl/chain_spec.rb
|
353
|
-
- spec/dsl/checks_spec.rb
|
354
|
-
- spec/dsl/config_spec.rb
|
355
|
-
- spec/dsl/dsl_spec.rb
|
356
|
-
- spec/dsl/getter_spec.rb
|
357
|
-
- spec/dsl/integration_spec.rb
|
358
|
-
- spec/dsl/load_spec.rb
|
359
|
-
- spec/dsl/notify_spec.rb
|
360
|
-
- spec/dsl/process_spec.rb
|
361
|
-
- spec/dsl/sub_procs_spec.rb
|
362
|
-
- spec/dsl/with_server_spec.rb
|
363
|
-
- spec/example/em.rb
|
364
|
-
- spec/example/forking.rb
|
365
|
-
- spec/example/sample.rb
|
366
|
-
- spec/fixtures/dsl/0.rb
|
367
|
-
- spec/fixtures/dsl/0a.rb
|
368
|
-
- spec/fixtures/dsl/0c.rb
|
369
|
-
- spec/fixtures/dsl/1.rb
|
370
|
-
- spec/fixtures/dsl/bad.eye
|
371
|
-
- spec/fixtures/dsl/configs/1.eye
|
372
|
-
- spec/fixtures/dsl/configs/2.eye
|
373
|
-
- spec/fixtures/dsl/configs/3.eye
|
374
|
-
- spec/fixtures/dsl/configs/4.eye
|
375
|
-
- spec/fixtures/dsl/empty.eye
|
376
|
-
- spec/fixtures/dsl/include_test.eye
|
377
|
-
- spec/fixtures/dsl/include_test/1.rb
|
378
|
-
- spec/fixtures/dsl/include_test/ha.rb
|
379
|
-
- spec/fixtures/dsl/include_test2.eye
|
380
|
-
- spec/fixtures/dsl/integration.eye
|
381
|
-
- spec/fixtures/dsl/integration2.eye
|
382
|
-
- spec/fixtures/dsl/integration_locks.eye
|
383
|
-
- spec/fixtures/dsl/integration_sor.eye
|
384
|
-
- spec/fixtures/dsl/integration_sor2.eye
|
385
|
-
- spec/fixtures/dsl/integration_sor3.eye
|
386
|
-
- spec/fixtures/dsl/load.eye
|
387
|
-
- spec/fixtures/dsl/load2.eye
|
388
|
-
- spec/fixtures/dsl/load2_dup2.eye
|
389
|
-
- spec/fixtures/dsl/load2_dup_pid.eye
|
390
|
-
- spec/fixtures/dsl/load3.eye
|
391
|
-
- spec/fixtures/dsl/load4.eye
|
392
|
-
- spec/fixtures/dsl/load5.eye
|
393
|
-
- spec/fixtures/dsl/load6.eye
|
394
|
-
- spec/fixtures/dsl/load_dubls.eye
|
395
|
-
- spec/fixtures/dsl/load_dup_ex_names.eye
|
396
|
-
- spec/fixtures/dsl/load_error.eye
|
397
|
-
- spec/fixtures/dsl/load_error_folder/load3.eye
|
398
|
-
- spec/fixtures/dsl/load_error_folder/load4.eye
|
399
|
-
- spec/fixtures/dsl/load_folder/load3.eye
|
400
|
-
- spec/fixtures/dsl/load_folder/load4.eye
|
401
|
-
- spec/fixtures/dsl/load_int.eye
|
402
|
-
- spec/fixtures/dsl/load_int2.eye
|
403
|
-
- spec/fixtures/dsl/load_logger.eye
|
404
|
-
- spec/fixtures/dsl/load_logger2.eye
|
405
|
-
- spec/fixtures/dsl/long_load.eye
|
406
|
-
- spec/fixtures/dsl/subfolder1/proc1.rb
|
407
|
-
- spec/fixtures/dsl/subfolder2.eye
|
408
|
-
- spec/fixtures/dsl/subfolder2/common.rb
|
409
|
-
- spec/fixtures/dsl/subfolder2/proc2.rb
|
410
|
-
- spec/fixtures/dsl/subfolder2/sub/proc3.rb
|
411
|
-
- spec/fixtures/dsl/subfolder3.eye
|
412
|
-
- spec/fixtures/dsl/subfolder3/common.rb
|
413
|
-
- spec/fixtures/dsl/subfolder3/proc4.rb
|
414
|
-
- spec/fixtures/dsl/subfolder3/sub/proc5.rb
|
415
|
-
- spec/fixtures/dsl/subfolder4.eye
|
416
|
-
- spec/fixtures/dsl/subfolder4/a.rb
|
417
|
-
- spec/fixtures/dsl/subfolder4/b.rb
|
418
|
-
- spec/fixtures/dsl/subfolder4/c.rb
|
419
|
-
- spec/mock_spec.rb
|
420
|
-
- spec/notify/jabber_spec.rb
|
421
|
-
- spec/notify/mail_spec.rb
|
422
|
-
- spec/notify_spec.rb
|
423
|
-
- spec/process/checks/child_checks_spec.rb
|
424
|
-
- spec/process/checks/cpu_spec.rb
|
425
|
-
- spec/process/checks/ctime_spec.rb
|
426
|
-
- spec/process/checks/fsize_spec.rb
|
427
|
-
- spec/process/checks/http_spec.rb
|
428
|
-
- spec/process/checks/intergration_spec.rb
|
429
|
-
- spec/process/checks/memory_spec.rb
|
430
|
-
- spec/process/child_process_spec.rb
|
431
|
-
- spec/process/config_spec.rb
|
432
|
-
- spec/process/controller_spec.rb
|
433
|
-
- spec/process/monitoring_spec.rb
|
434
|
-
- spec/process/notify_spec.rb
|
435
|
-
- spec/process/restart_spec.rb
|
436
|
-
- spec/process/scheduler_spec.rb
|
437
|
-
- spec/process/start_spec.rb
|
438
|
-
- spec/process/states_history_spec.rb
|
439
|
-
- spec/process/stop_spec.rb
|
440
|
-
- spec/process/system_spec.rb
|
441
|
-
- spec/process/triggers/flapping_spec.rb
|
442
|
-
- spec/process/update_config_spec.rb
|
443
|
-
- spec/spec_helper.rb
|
444
|
-
- spec/support/rr_celluloid.rb
|
445
|
-
- spec/support/spec_support.rb
|
446
|
-
- spec/system_resources_spec.rb
|
447
|
-
- spec/system_spec.rb
|
448
|
-
- spec/utils/alive_array_spec.rb
|
449
|
-
- spec/utils/celluloid_chain_spec.rb
|
450
|
-
- spec/utils/tail_spec.rb
|
451
333
|
homepage: http://github.com/kostya/eye
|
452
334
|
licenses:
|
453
335
|
- MIT
|
@@ -473,120 +355,4 @@ signing_key:
|
|
473
355
|
specification_version: 4
|
474
356
|
summary: Process monitoring tool. An alternative to God and Bluepill. With Bluepill
|
475
357
|
like config syntax. Requires MRI Ruby >= 1.9.2. Uses Celluloid and Celluloid::IO.
|
476
|
-
test_files:
|
477
|
-
- spec/checker/cpu_spec.rb
|
478
|
-
- spec/checker/file_ctime_spec.rb
|
479
|
-
- spec/checker/file_size_spec.rb
|
480
|
-
- spec/checker/http_spec.rb
|
481
|
-
- spec/checker/memory_spec.rb
|
482
|
-
- spec/checker/socket_spec.rb
|
483
|
-
- spec/checker_spec.rb
|
484
|
-
- spec/child_process/child_process_spec.rb
|
485
|
-
- spec/client_server_spec.rb
|
486
|
-
- spec/controller/commands_spec.rb
|
487
|
-
- spec/controller/controller_spec.rb
|
488
|
-
- spec/controller/find_objects_spec.rb
|
489
|
-
- spec/controller/group_spec.rb
|
490
|
-
- spec/controller/intergration_spec.rb
|
491
|
-
- spec/controller/load_spec.rb
|
492
|
-
- spec/controller/races_spec.rb
|
493
|
-
- spec/controller/stop_on_delete_spec.rb
|
494
|
-
- spec/dsl/chain_spec.rb
|
495
|
-
- spec/dsl/checks_spec.rb
|
496
|
-
- spec/dsl/config_spec.rb
|
497
|
-
- spec/dsl/dsl_spec.rb
|
498
|
-
- spec/dsl/getter_spec.rb
|
499
|
-
- spec/dsl/integration_spec.rb
|
500
|
-
- spec/dsl/load_spec.rb
|
501
|
-
- spec/dsl/notify_spec.rb
|
502
|
-
- spec/dsl/process_spec.rb
|
503
|
-
- spec/dsl/sub_procs_spec.rb
|
504
|
-
- spec/dsl/with_server_spec.rb
|
505
|
-
- spec/example/em.rb
|
506
|
-
- spec/example/forking.rb
|
507
|
-
- spec/example/sample.rb
|
508
|
-
- spec/fixtures/dsl/0.rb
|
509
|
-
- spec/fixtures/dsl/0a.rb
|
510
|
-
- spec/fixtures/dsl/0c.rb
|
511
|
-
- spec/fixtures/dsl/1.rb
|
512
|
-
- spec/fixtures/dsl/bad.eye
|
513
|
-
- spec/fixtures/dsl/configs/1.eye
|
514
|
-
- spec/fixtures/dsl/configs/2.eye
|
515
|
-
- spec/fixtures/dsl/configs/3.eye
|
516
|
-
- spec/fixtures/dsl/configs/4.eye
|
517
|
-
- spec/fixtures/dsl/empty.eye
|
518
|
-
- spec/fixtures/dsl/include_test.eye
|
519
|
-
- spec/fixtures/dsl/include_test/1.rb
|
520
|
-
- spec/fixtures/dsl/include_test/ha.rb
|
521
|
-
- spec/fixtures/dsl/include_test2.eye
|
522
|
-
- spec/fixtures/dsl/integration.eye
|
523
|
-
- spec/fixtures/dsl/integration2.eye
|
524
|
-
- spec/fixtures/dsl/integration_locks.eye
|
525
|
-
- spec/fixtures/dsl/integration_sor.eye
|
526
|
-
- spec/fixtures/dsl/integration_sor2.eye
|
527
|
-
- spec/fixtures/dsl/integration_sor3.eye
|
528
|
-
- spec/fixtures/dsl/load.eye
|
529
|
-
- spec/fixtures/dsl/load2.eye
|
530
|
-
- spec/fixtures/dsl/load2_dup2.eye
|
531
|
-
- spec/fixtures/dsl/load2_dup_pid.eye
|
532
|
-
- spec/fixtures/dsl/load3.eye
|
533
|
-
- spec/fixtures/dsl/load4.eye
|
534
|
-
- spec/fixtures/dsl/load5.eye
|
535
|
-
- spec/fixtures/dsl/load6.eye
|
536
|
-
- spec/fixtures/dsl/load_dubls.eye
|
537
|
-
- spec/fixtures/dsl/load_dup_ex_names.eye
|
538
|
-
- spec/fixtures/dsl/load_error.eye
|
539
|
-
- spec/fixtures/dsl/load_error_folder/load3.eye
|
540
|
-
- spec/fixtures/dsl/load_error_folder/load4.eye
|
541
|
-
- spec/fixtures/dsl/load_folder/load3.eye
|
542
|
-
- spec/fixtures/dsl/load_folder/load4.eye
|
543
|
-
- spec/fixtures/dsl/load_int.eye
|
544
|
-
- spec/fixtures/dsl/load_int2.eye
|
545
|
-
- spec/fixtures/dsl/load_logger.eye
|
546
|
-
- spec/fixtures/dsl/load_logger2.eye
|
547
|
-
- spec/fixtures/dsl/long_load.eye
|
548
|
-
- spec/fixtures/dsl/subfolder1/proc1.rb
|
549
|
-
- spec/fixtures/dsl/subfolder2.eye
|
550
|
-
- spec/fixtures/dsl/subfolder2/common.rb
|
551
|
-
- spec/fixtures/dsl/subfolder2/proc2.rb
|
552
|
-
- spec/fixtures/dsl/subfolder2/sub/proc3.rb
|
553
|
-
- spec/fixtures/dsl/subfolder3.eye
|
554
|
-
- spec/fixtures/dsl/subfolder3/common.rb
|
555
|
-
- spec/fixtures/dsl/subfolder3/proc4.rb
|
556
|
-
- spec/fixtures/dsl/subfolder3/sub/proc5.rb
|
557
|
-
- spec/fixtures/dsl/subfolder4.eye
|
558
|
-
- spec/fixtures/dsl/subfolder4/a.rb
|
559
|
-
- spec/fixtures/dsl/subfolder4/b.rb
|
560
|
-
- spec/fixtures/dsl/subfolder4/c.rb
|
561
|
-
- spec/mock_spec.rb
|
562
|
-
- spec/notify/jabber_spec.rb
|
563
|
-
- spec/notify/mail_spec.rb
|
564
|
-
- spec/notify_spec.rb
|
565
|
-
- spec/process/checks/child_checks_spec.rb
|
566
|
-
- spec/process/checks/cpu_spec.rb
|
567
|
-
- spec/process/checks/ctime_spec.rb
|
568
|
-
- spec/process/checks/fsize_spec.rb
|
569
|
-
- spec/process/checks/http_spec.rb
|
570
|
-
- spec/process/checks/intergration_spec.rb
|
571
|
-
- spec/process/checks/memory_spec.rb
|
572
|
-
- spec/process/child_process_spec.rb
|
573
|
-
- spec/process/config_spec.rb
|
574
|
-
- spec/process/controller_spec.rb
|
575
|
-
- spec/process/monitoring_spec.rb
|
576
|
-
- spec/process/notify_spec.rb
|
577
|
-
- spec/process/restart_spec.rb
|
578
|
-
- spec/process/scheduler_spec.rb
|
579
|
-
- spec/process/start_spec.rb
|
580
|
-
- spec/process/states_history_spec.rb
|
581
|
-
- spec/process/stop_spec.rb
|
582
|
-
- spec/process/system_spec.rb
|
583
|
-
- spec/process/triggers/flapping_spec.rb
|
584
|
-
- spec/process/update_config_spec.rb
|
585
|
-
- spec/spec_helper.rb
|
586
|
-
- spec/support/rr_celluloid.rb
|
587
|
-
- spec/support/spec_support.rb
|
588
|
-
- spec/system_resources_spec.rb
|
589
|
-
- spec/system_spec.rb
|
590
|
-
- spec/utils/alive_array_spec.rb
|
591
|
-
- spec/utils/celluloid_chain_spec.rb
|
592
|
-
- spec/utils/tail_spec.rb
|
358
|
+
test_files: []
|