eye 0.8.pre → 0.8.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +4 -0
- data/Rakefile +1 -1
- data/examples/custom_trigger.eye +28 -0
- data/eye.gemspec +1 -1
- data/lib/eye.rb +1 -1
- data/lib/eye/cli.rb +27 -8
- data/lib/eye/dsl/opts.rb +2 -2
- data/lib/eye/group.rb +3 -2
- data/lib/eye/loader.rb +2 -2
- data/lib/eye/process/commands.rb +17 -15
- data/lib/eye/process/config.rb +4 -0
- data/lib/eye/process/controller.rb +5 -19
- data/lib/eye/process/monitor.rb +67 -58
- data/lib/eye/process/states.rb +2 -1
- data/lib/eye/process/system.rb +30 -14
- data/lib/eye/process/watchers.rb +6 -0
- data/lib/eye/system_resources.rb +5 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9b7bd7917fbb58bb490f4f436c4c61736127eb4
|
4
|
+
data.tar.gz: 240e3c98f60432b0f43c2895e52782adf99d750f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f809b87646a8a2e3092df493af89fdc26155f88d01c6709df3a5efe50dda2c3bdbef0a99306bb54d86faaf387e9727e8341f2bbdb3578e15d8a14c3a28f8536a
|
7
|
+
data.tar.gz: 4af77bcf0306370cabaf0bbbbc0a635460e658177ecee12d2e6381a15decac7dabd52847bbe603912b9288f42a9e6a396cd746527ddc2c7190c20c0515132bb7
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -137,6 +137,10 @@ foreground load:
|
|
137
137
|
|
138
138
|
If the eye daemon has already started and you call the `load` command, the config will be updated (into eye daemon). New objects(applications, groups, processes) will be added and monitored. Processes removed from the config will be removed (and stopped if the process has `stop_on_delete true`). Other objects will update their configs.
|
139
139
|
|
140
|
+
Two global configs loaded by default, if it exists (with the first eye load):
|
141
|
+
|
142
|
+
/etc/eye.conf
|
143
|
+
~/.eyeconfig
|
140
144
|
|
141
145
|
Process statuses:
|
142
146
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# send notify when many times crashed process, finally resolved
|
2
|
+
|
3
|
+
class Eye::Trigger::FixCrash < Eye::Trigger::Custom
|
4
|
+
param :times, Fixnum, nil, 1
|
5
|
+
param_default :to, :up
|
6
|
+
|
7
|
+
def check(_)
|
8
|
+
# process states here like this: [..., :starting, :down, :starting, :down, :starting, :up]
|
9
|
+
states = process.states_history.states
|
10
|
+
|
11
|
+
# states to compare with
|
12
|
+
compare = [:starting, :down] * times + [:starting, :up]
|
13
|
+
|
14
|
+
if states[-compare.length..-1] == compare
|
15
|
+
process.notify(:info, "yahho, process up")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Eye.app :custom_trigger do
|
21
|
+
trigger :fix_crash
|
22
|
+
|
23
|
+
process :some do
|
24
|
+
pid_file '/tmp/custom_trigger_some.pid'
|
25
|
+
start_command "ruby -e 's = `cat /tmp/bla`; exit(1) unless s =~ /bla/; loop { sleep 1 } '"
|
26
|
+
daemonize!
|
27
|
+
end
|
28
|
+
end
|
data/eye.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.required_ruby_version = '>= 1.9.2'
|
20
20
|
gem.required_rubygems_version = '>= 1.3.6'
|
21
21
|
|
22
|
-
gem.add_dependency 'celluloid', '~> 0.17.
|
22
|
+
gem.add_dependency 'celluloid', '~> 0.17.2'
|
23
23
|
gem.add_dependency 'celluloid-io', '~> 0.17.0'
|
24
24
|
gem.add_dependency 'state_machine'
|
25
25
|
gem.add_dependency 'thor'
|
data/lib/eye.rb
CHANGED
data/lib/eye/cli.rb
CHANGED
@@ -21,8 +21,7 @@ class Eye::Cli < Thor
|
|
21
21
|
end
|
22
22
|
|
23
23
|
if options[:json]
|
24
|
-
|
25
|
-
say JSON.dump(res)
|
24
|
+
say_json(res)
|
26
25
|
else
|
27
26
|
say render_info(res)
|
28
27
|
say
|
@@ -39,27 +38,42 @@ class Eye::Cli < Thor
|
|
39
38
|
|
40
39
|
desc "xinfo", "eye-deamon info (-c show current config)"
|
41
40
|
method_option :config, :type => :boolean, :aliases => "-c"
|
41
|
+
method_option :json, :type => :boolean, :aliases => "-j"
|
42
42
|
def xinfo
|
43
43
|
res = cmd(:debug_data, :config => options[:config])
|
44
|
-
|
45
|
-
|
44
|
+
if options[:json]
|
45
|
+
say_json(res)
|
46
|
+
else
|
47
|
+
say render_debug_info(res)
|
48
|
+
say
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
desc "oinfo", "onelined info"
|
53
|
+
method_option :json, :type => :boolean, :aliases => "-j"
|
49
54
|
def oinfo(mask = nil)
|
50
55
|
res = cmd(:short_data, *Array(mask))
|
51
|
-
|
52
|
-
|
56
|
+
if options[:json]
|
57
|
+
say_json(res)
|
58
|
+
else
|
59
|
+
say render_info(res)
|
60
|
+
say
|
61
|
+
end
|
53
62
|
end
|
54
63
|
|
55
64
|
desc "history [MASK,...]", "processes history"
|
65
|
+
method_option :json, :type => :boolean, :aliases => "-j"
|
56
66
|
def history(*masks)
|
57
67
|
res = cmd(:history_data, *masks)
|
58
68
|
if !masks.empty? && res && res.empty?
|
59
69
|
error!("command :history, objects not found!")
|
60
70
|
end
|
61
|
-
|
62
|
-
|
71
|
+
if options[:json]
|
72
|
+
say_json(res)
|
73
|
+
else
|
74
|
+
say render_history(res)
|
75
|
+
say
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
desc "load [CONF, ...]", "load config (run eye-daemon if not) (-f foreground load)"
|
@@ -202,6 +216,11 @@ private
|
|
202
216
|
end
|
203
217
|
end
|
204
218
|
|
219
|
+
def say_json(obj)
|
220
|
+
require 'json'
|
221
|
+
say JSON.dump(obj)
|
222
|
+
end
|
223
|
+
|
205
224
|
def self.exit_on_failure?
|
206
225
|
true
|
207
226
|
end
|
data/lib/eye/dsl/opts.rb
CHANGED
@@ -4,12 +4,12 @@ class Eye::Dsl::Opts < Eye::Dsl::PureOpts
|
|
4
4
|
:stop_command, :restart_command, :uid, :gid ]
|
5
5
|
create_options_methods(STR_OPTIONS, String)
|
6
6
|
|
7
|
-
BOOL_OPTIONS = [ :daemonize, :keep_alive, :auto_start, :stop_on_delete, :clear_pid, :preserve_fds, :use_leaf_child, :clear_env ]
|
7
|
+
BOOL_OPTIONS = [ :daemonize, :keep_alive, :auto_start, :stop_on_delete, :clear_pid, :preserve_fds, :use_leaf_child, :clear_env, :check_identity ]
|
8
8
|
create_options_methods(BOOL_OPTIONS, [TrueClass, FalseClass])
|
9
9
|
|
10
10
|
INTERVAL_OPTIONS = [ :check_alive_period, :start_timeout, :restart_timeout, :stop_timeout, :start_grace,
|
11
11
|
:restart_grace, :stop_grace, :children_update_period, :restore_in,
|
12
|
-
:auto_update_pidfile_grace, :revert_fuckup_pidfile_grace ]
|
12
|
+
:auto_update_pidfile_grace, :revert_fuckup_pidfile_grace, :check_identity_period, :check_identity_grace ]
|
13
13
|
create_options_methods(INTERVAL_OPTIONS, [Fixnum, Float])
|
14
14
|
|
15
15
|
create_options_methods([:environment], Hash)
|
data/lib/eye/group.rb
CHANGED
@@ -70,8 +70,9 @@ class Eye::Group
|
|
70
70
|
def status_data_short
|
71
71
|
h = Hash.new
|
72
72
|
@processes.each do |p|
|
73
|
-
|
74
|
-
h[
|
73
|
+
state = p.state
|
74
|
+
h[state] ||= 0
|
75
|
+
h[state] += 1
|
75
76
|
end
|
76
77
|
{ name: (@name == '__default__' ? 'default' : @name), type: :group, states: h }
|
77
78
|
end
|
data/lib/eye/loader.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# add gems to $: by `gem` method
|
2
2
|
# this is only way when install eye as system wide
|
3
3
|
|
4
|
-
gem 'celluloid', '~> 0.17.
|
4
|
+
gem 'celluloid', '~> 0.17.2'
|
5
5
|
gem 'celluloid-io', '~> 0.17.0'
|
6
6
|
gem 'nio4r'
|
7
7
|
gem 'timers'
|
8
8
|
|
9
9
|
gem 'state_machine'
|
10
|
-
gem 'sigar', '~> 0.7.
|
10
|
+
gem 'sigar', '~> 0.7.3'
|
data/lib/eye/process/commands.rb
CHANGED
@@ -25,7 +25,6 @@ module Eye::Process::Commands
|
|
25
25
|
sleep 0.2 # little grace
|
26
26
|
end
|
27
27
|
|
28
|
-
self.pid = nil
|
29
28
|
switch :crashed
|
30
29
|
end
|
31
30
|
|
@@ -42,6 +41,8 @@ module Eye::Process::Commands
|
|
42
41
|
|
43
42
|
switch :stopping
|
44
43
|
|
44
|
+
return unless check_identity
|
45
|
+
|
45
46
|
kill_process
|
46
47
|
|
47
48
|
if process_really_running?
|
@@ -69,9 +70,11 @@ module Eye::Process::Commands
|
|
69
70
|
switch :restarting
|
70
71
|
|
71
72
|
if self[:restart_command]
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
return unless check_identity
|
74
|
+
if execute_restart_command
|
75
|
+
sleep_grace(:restart_grace)
|
76
|
+
end
|
77
|
+
result = process_really_running? || (load_external_pid_file == :ok)
|
75
78
|
switch(result ? :restarted : :crashed)
|
76
79
|
else
|
77
80
|
stop_process
|
@@ -240,19 +243,16 @@ private
|
|
240
243
|
|
241
244
|
sleep_grace(:start_grace)
|
242
245
|
|
243
|
-
|
246
|
+
case load_external_pid_file
|
247
|
+
when :ok
|
248
|
+
res.merge(:pid => self.pid)
|
249
|
+
when :no_pid_file
|
244
250
|
error "exit status #{res[:exitstatus]}, pid_file (#{self[:pid_file_ex]}) did not appear within the start_grace period (#{self[:start_grace].to_f}s); check your start_command, or tune the start_grace value (eye expect process to create pid_file in self-daemonization mode)"
|
245
|
-
|
251
|
+
{ :error => :pid_not_found }
|
252
|
+
when :not_running
|
253
|
+
error "exit status #{res[:exitstatus]}, process <#{@last_loaded_pid}> (from #{self[:pid_file_ex]}) was not found; ensure that the pid_file is being updated correctly (#{check_logs_str})"
|
254
|
+
{ :error => :not_really_running }
|
246
255
|
end
|
247
|
-
|
248
|
-
unless process_really_running?
|
249
|
-
error "exit status #{res[:exitstatus]}, process <#{self.pid}> (from #{self[:pid_file_ex]}) was not found; ensure that the pid_file is being updated correctly (#{check_logs_str})"
|
250
|
-
return {:error => :not_really_running}
|
251
|
-
end
|
252
|
-
|
253
|
-
res[:pid] = self.pid
|
254
|
-
info "exit status #{res[:exitstatus]}, process <#{res[:pid]}> (from #{self[:pid_file_ex]}) was found"
|
255
|
-
res
|
256
256
|
end
|
257
257
|
|
258
258
|
def check_logs_str
|
@@ -278,6 +278,8 @@ private
|
|
278
278
|
end
|
279
279
|
|
280
280
|
def execute_user_command(name, cmd)
|
281
|
+
return unless check_identity
|
282
|
+
|
281
283
|
info "executing user command #{name} #{cmd.inspect}"
|
282
284
|
|
283
285
|
# cmd is string, or array of signals
|
data/lib/eye/process/config.rb
CHANGED
@@ -4,6 +4,10 @@ module Eye::Process::Config
|
|
4
4
|
:keep_alive => true, # restart when crashed
|
5
5
|
:check_alive_period => 5.seconds,
|
6
6
|
|
7
|
+
:check_identity => true,
|
8
|
+
:check_identity_period => 60.seconds,
|
9
|
+
:check_identity_grace => 60.seconds,
|
10
|
+
|
7
11
|
:start_timeout => 15.seconds,
|
8
12
|
:stop_timeout => 10.seconds,
|
9
13
|
:restart_timeout => 10.seconds,
|
@@ -5,21 +5,12 @@ module Eye::Process::Controller
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def start
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
switch :already_running
|
12
|
-
:ok
|
13
|
-
else
|
14
|
-
info "pid_file found, but process <#{self.pid}> is down, starting..."
|
15
|
-
start_process
|
16
|
-
end
|
8
|
+
if load_external_pid_file == :ok
|
9
|
+
switch :already_running
|
10
|
+
:ok
|
17
11
|
else
|
18
|
-
info 'pid_file not found, starting...'
|
19
12
|
start_process
|
20
13
|
end
|
21
|
-
|
22
|
-
res
|
23
14
|
end
|
24
15
|
|
25
16
|
def stop
|
@@ -28,10 +19,7 @@ module Eye::Process::Controller
|
|
28
19
|
end
|
29
20
|
|
30
21
|
def restart
|
31
|
-
unless pid # unmonitored case
|
32
|
-
try_update_pid_from_file
|
33
|
-
end
|
34
|
-
|
22
|
+
load_external_pid_file unless pid # unmonitored case
|
35
23
|
restart_process
|
36
24
|
end
|
37
25
|
|
@@ -39,11 +27,9 @@ module Eye::Process::Controller
|
|
39
27
|
if self[:auto_start]
|
40
28
|
start
|
41
29
|
else
|
42
|
-
if
|
43
|
-
info "process <#{self.pid}> from pid_file is already running"
|
30
|
+
if load_external_pid_file == :ok
|
44
31
|
switch :already_running
|
45
32
|
else
|
46
|
-
warn 'process not found, unmonitoring'
|
47
33
|
schedule :unmonitor, Eye::Reason.new(:'not found')
|
48
34
|
end
|
49
35
|
end
|
data/lib/eye/process/monitor.rb
CHANGED
@@ -2,32 +2,28 @@ module Eye::Process::Monitor
|
|
2
2
|
|
3
3
|
private
|
4
4
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def try_update_pid_from_file
|
16
|
-
# if pid file was rewritten
|
17
|
-
newpid = load_pid_from_file
|
18
|
-
if newpid != self.pid
|
19
|
-
info "process <#{self.pid}> changed pid to <#{newpid}>, updating..." if self.pid
|
5
|
+
def load_external_pid_file
|
6
|
+
newpid = failsafe_load_pid
|
7
|
+
|
8
|
+
if !newpid
|
9
|
+
self.pid = nil
|
10
|
+
info "load_external_pid_file: pid_file not found"
|
11
|
+
:no_pid_file
|
12
|
+
elsif process_pid_running?(newpid)
|
20
13
|
self.pid = newpid
|
21
|
-
|
22
|
-
if
|
23
|
-
|
14
|
+
res = compare_identity
|
15
|
+
if res == :fail
|
16
|
+
warn "load_external_pid_file: process <#{self.pid}> from pid_file failed check_identity"
|
17
|
+
:bad_identity
|
24
18
|
else
|
25
|
-
|
26
|
-
|
19
|
+
info "load_external_pid_file: process <#{self.pid}> from pid_file found and running (identity: #{res}) (#{Eye::SystemResources.args(self.pid)})"
|
20
|
+
:ok
|
27
21
|
end
|
28
22
|
else
|
29
|
-
|
30
|
-
|
23
|
+
@last_loaded_pid = newpid
|
24
|
+
self.pid = nil
|
25
|
+
info "load_external_pid_file: pid_file found, but process <#{newpid}> not found"
|
26
|
+
:not_running
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
@@ -38,48 +34,61 @@ private
|
|
38
34
|
unless process_really_running?
|
39
35
|
warn "check_alive: process <#{self.pid}> not found"
|
40
36
|
notify :info, 'crashed!'
|
41
|
-
clear_pid_file if control_pid?
|
37
|
+
clear_pid_file(true) if control_pid?
|
42
38
|
|
43
39
|
switch :crashed, Eye::Reason.new(:crashed)
|
44
40
|
else
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
warn msg
|
41
|
+
check_pid_file
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def check_pid_file
|
47
|
+
ppid = failsafe_load_pid
|
48
|
+
return if ppid == self.pid
|
49
|
+
|
50
|
+
msg = "check_alive: pid_file (#{self[:pid_file]}) changed by itself (<#{self.pid}> => <#{ppid}>)"
|
51
|
+
if control_pid?
|
52
|
+
msg += ", reverting to <#{self.pid}> (the pid_file is controlled by eye)"
|
53
|
+
unless failsafe_save_pid
|
54
|
+
msg += ", pid_file write failed! O_o"
|
55
|
+
end
|
56
|
+
else
|
57
|
+
changed_ago_s = Time.now - pid_file_ctime
|
58
|
+
|
59
|
+
if ppid == nil
|
60
|
+
msg += ", reverting to <#{self.pid}> (the pid_file is empty)"
|
61
|
+
unless failsafe_save_pid
|
62
|
+
msg += ", pid_file write failed! O_o"
|
63
|
+
end
|
64
|
+
|
65
|
+
elsif (changed_ago_s > self[:auto_update_pidfile_grace]) && process_pid_running?(ppid) && (compare_identity(ppid) != :fail)
|
66
|
+
msg += ", trusting this change, and now monitor <#{ppid}>"
|
67
|
+
self.pid = ppid
|
68
|
+
|
69
|
+
elsif (changed_ago_s > self[:revert_fuckup_pidfile_grace])
|
70
|
+
msg += " over #{self[:revert_fuckup_pidfile_grace]}s ago, reverting to <#{self.pid}>, because <#{ppid}> not alive"
|
71
|
+
unless failsafe_save_pid
|
72
|
+
msg += ", pid_file write failed! O_o"
|
80
73
|
end
|
74
|
+
|
75
|
+
else
|
76
|
+
msg += ', ignoring self-managed pid change'
|
81
77
|
end
|
82
78
|
end
|
79
|
+
|
80
|
+
warn msg
|
81
|
+
end
|
82
|
+
|
83
|
+
def check_identity
|
84
|
+
if compare_identity == :fail
|
85
|
+
notify :info, 'crashed by identity!'
|
86
|
+
switch :crashed, Eye::Reason.new(:crashed_by_identity)
|
87
|
+
clear_pid_file if self[:clear_pid]
|
88
|
+
false
|
89
|
+
else
|
90
|
+
true
|
91
|
+
end
|
83
92
|
end
|
84
93
|
|
85
94
|
def check_crash
|
data/lib/eye/process/states.rb
CHANGED
@@ -27,7 +27,7 @@ class Eye::Process
|
|
27
27
|
end
|
28
28
|
|
29
29
|
event :crashed do
|
30
|
-
transition [:starting, :restarting, :up] => :down
|
30
|
+
transition [:starting, :restarting, :stopping, :up] => :down
|
31
31
|
end
|
32
32
|
|
33
33
|
event :stopping do
|
@@ -69,6 +69,7 @@ class Eye::Process
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def on_crashed
|
72
|
+
self.pid = nil
|
72
73
|
schedule :check_crash, Eye::Reason.new(:crashed)
|
73
74
|
end
|
74
75
|
|
data/lib/eye/process/system.rb
CHANGED
@@ -3,16 +3,7 @@ require 'timeout'
|
|
3
3
|
module Eye::Process::System
|
4
4
|
|
5
5
|
def load_pid_from_file
|
6
|
-
|
7
|
-
_pid = File.read(self[:pid_file_ex]).to_i
|
8
|
-
_pid > 0 ? _pid : nil
|
9
|
-
end
|
10
|
-
|
11
|
-
res
|
12
|
-
end
|
13
|
-
|
14
|
-
def set_pid_from_file
|
15
|
-
self.pid = load_pid_from_file
|
6
|
+
File.read(self[:pid_file_ex]).to_i rescue nil
|
16
7
|
end
|
17
8
|
|
18
9
|
def save_pid_to_file
|
@@ -26,7 +17,8 @@ module Eye::Process::System
|
|
26
17
|
end
|
27
18
|
end
|
28
19
|
|
29
|
-
def clear_pid_file
|
20
|
+
def clear_pid_file(check_content = false)
|
21
|
+
return if check_content && self.pid && load_pid_from_file != self.pid
|
30
22
|
info "delete pid_file: #{self[:pid_file_ex]}"
|
31
23
|
File.unlink(self[:pid_file_ex])
|
32
24
|
true
|
@@ -38,6 +30,31 @@ module Eye::Process::System
|
|
38
30
|
File.ctime(self[:pid_file_ex]) rescue Time.now
|
39
31
|
end
|
40
32
|
|
33
|
+
def get_identity
|
34
|
+
File.mtime(self[:pid_file_ex])
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def compare_identity(pid = self.pid)
|
40
|
+
return :ok unless self[:check_identity]
|
41
|
+
return :no_pid unless pid
|
42
|
+
id = get_identity
|
43
|
+
return :no_pid_file unless id
|
44
|
+
st = Eye::SystemResources.start_time(pid)
|
45
|
+
return :no_start_time unless st
|
46
|
+
st1 = st.to_i
|
47
|
+
id1 = id.to_i
|
48
|
+
if (id1 - st1).abs > self[:check_identity_grace]
|
49
|
+
msg = "pid_file: '#{Eye::Utils.human_time2(id)}', process: '#{Eye::Utils.human_time2(st)}' (#{Eye::SystemResources.args(pid)})"
|
50
|
+
res = (id1 < st1) ? :fail : :touched
|
51
|
+
warn "compare_identity: #{res}, #{msg}"
|
52
|
+
res
|
53
|
+
else
|
54
|
+
:ok
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
41
58
|
def process_really_running?
|
42
59
|
process_pid_running?(self.pid)
|
43
60
|
end
|
@@ -97,13 +114,12 @@ module Eye::Process::System
|
|
97
114
|
def failsafe_load_pid
|
98
115
|
pid = load_pid_from_file
|
99
116
|
|
100
|
-
|
101
|
-
# this is can be symlink changed case
|
117
|
+
unless pid # this is can be symlink changed case
|
102
118
|
sleep 0.1
|
103
119
|
pid = load_pid_from_file
|
104
120
|
end
|
105
121
|
|
106
|
-
pid
|
122
|
+
pid if pid && pid > 0
|
107
123
|
end
|
108
124
|
|
109
125
|
def failsafe_save_pid
|
data/lib/eye/process/watchers.rb
CHANGED
@@ -11,6 +11,12 @@ module Eye::Process::Watchers
|
|
11
11
|
check_alive
|
12
12
|
end
|
13
13
|
|
14
|
+
if self[:check_identity]
|
15
|
+
add_watcher(:check_identity, self[:check_identity_period]) do
|
16
|
+
check_identity
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
# monitor children pids
|
15
21
|
if self[:monitor_children]
|
16
22
|
add_watcher(:check_children, self[:children_update_period]) do
|
data/lib/eye/system_resources.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'celluloid'
|
1
|
+
require 'celluloid/current'
|
2
2
|
|
3
3
|
class Eye::SystemResources
|
4
4
|
|
@@ -57,6 +57,10 @@ class Eye::SystemResources
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def args(pid)
|
61
|
+
Eye::Sigar.proc_args(pid).join(' ').strip rescue '-'
|
62
|
+
end
|
63
|
+
|
60
64
|
def resources(pid)
|
61
65
|
{ :memory => memory(pid),
|
62
66
|
:cpu => cpu(pid),
|
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.8.
|
4
|
+
version: 0.8.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Makarchev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.17.
|
19
|
+
version: 0.17.2
|
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.17.
|
26
|
+
version: 0.17.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: celluloid-io
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,6 +311,7 @@ files:
|
|
311
311
|
- bin/eye
|
312
312
|
- bin/leye
|
313
313
|
- bin/loader_eye
|
314
|
+
- examples/custom_trigger.eye
|
314
315
|
- examples/delayed_job.eye
|
315
316
|
- examples/dependency.eye
|
316
317
|
- examples/notify.eye
|
@@ -438,7 +439,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
438
439
|
version: 1.3.6
|
439
440
|
requirements: []
|
440
441
|
rubyforge_project:
|
441
|
-
rubygems_version: 2.4.
|
442
|
+
rubygems_version: 2.4.5
|
442
443
|
signing_key:
|
443
444
|
specification_version: 4
|
444
445
|
summary: Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI)
|