eye 0.8.rc → 0.8
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 +7 -3
- data/lib/eye.rb +1 -1
- data/lib/eye/checker.rb +8 -6
- data/lib/eye/config.rb +19 -16
- data/lib/eye/controller.rb +1 -1
- data/lib/eye/controller/load.rb +1 -5
- data/lib/eye/dsl.rb +3 -1
- data/lib/eye/process/system.rb +1 -3
- data/lib/eye/system.rb +6 -2
- 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: 881c3139243423bac750f9b13715f7a17a05703b
|
4
|
+
data.tar.gz: 1cfb74cc03c6a05a70df392a5a7871868167e9ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e6b73614e4dc6dd54afb12324f15eb31850f9bb0acce786b4f677f63e313a806155afa523b9e10760743a24a2066f7ab948d8872cd039bffb62f74113bf227
|
7
|
+
data.tar.gz: 75b41b0387f461bf333064e98b869c25279dd73c5911778f95ffc00374fcf5639a6a5d90af0a2fd1a3ceca7e602673570e8cf77e475e760e26dc2b053b432235
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
0.8
|
1
|
+
0.8
|
2
2
|
-------
|
3
|
-
*
|
3
|
+
* info, xinfo, oinfo, history now support -j flag, to output json
|
4
|
+
* leye: many fixes (--eyehome, --eyefile)
|
5
|
+
* add flapping reretry_in (#152)
|
6
|
+
* add check_identity of processes, avoid many bugs with wrong pid_files, or auto changed pids (#62)
|
7
|
+
* update Celluloid to 0.17
|
4
8
|
|
5
9
|
0.7
|
6
10
|
-------
|
@@ -17,7 +21,7 @@
|
|
17
21
|
* some fixes in flapping
|
18
22
|
* add proxy_url to http check
|
19
23
|
* process with children, shows children history now
|
20
|
-
*
|
24
|
+
* update Celluloid to 0.16
|
21
25
|
|
22
26
|
0.6.4
|
23
27
|
-----
|
data/lib/eye.rb
CHANGED
data/lib/eye/checker.rb
CHANGED
@@ -97,11 +97,13 @@ class Eye::Checker
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def check
|
100
|
-
if initial_grace
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
if initial_grace
|
101
|
+
if Time.now - @initialized_at < initial_grace
|
102
|
+
debug { 'skipped initial grace' }
|
103
|
+
return true
|
104
|
+
else
|
105
|
+
@options[:initial_grace] = nil
|
106
|
+
end
|
105
107
|
end
|
106
108
|
|
107
109
|
@value = get_value_safe
|
@@ -124,7 +126,7 @@ class Eye::Checker
|
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
127
|
-
info "#{last_human_values} => #{result ? 'OK' : 'Fail'}"
|
129
|
+
info { "#{last_human_values} => #{result ? 'OK' : 'Fail'}" }
|
128
130
|
result
|
129
131
|
|
130
132
|
rescue Object => ex
|
data/lib/eye/config.rb
CHANGED
@@ -32,39 +32,40 @@ class Eye::Config
|
|
32
32
|
|
33
33
|
# raise an error if config wrong
|
34
34
|
def validate!(validate_apps = [])
|
35
|
-
all_processes = processes
|
36
|
-
|
37
35
|
# Check blank pid_files
|
38
|
-
no_pid_file =
|
39
|
-
if
|
36
|
+
no_pid_file = []
|
37
|
+
each_process { |c| no_pid_file << c if c[:pid_file].blank? }
|
38
|
+
if no_pid_file.any?
|
40
39
|
raise Eye::Dsl::Error, "blank pid_file for: #{no_pid_file.map { |c| c[:name] } * ', '}"
|
41
40
|
end
|
42
41
|
|
43
42
|
# Check duplicates of the full pid_file
|
44
43
|
|
45
|
-
dupl_pids =
|
44
|
+
dupl_pids = Hash.new(0)
|
45
|
+
each_process do |o|
|
46
46
|
ex_pid_file = Eye::System.normalized_file(o[:pid_file], o[:working_dir])
|
47
|
-
|
47
|
+
dupl_pids[ex_pid_file] += 1
|
48
48
|
end
|
49
49
|
dupl_pids = dupl_pids.select { |_, v| v > 1 }
|
50
50
|
|
51
|
-
if dupl_pids.
|
51
|
+
if dupl_pids.any?
|
52
52
|
raise Eye::Dsl::Error, "duplicate pid_files: #{dupl_pids.inspect}"
|
53
53
|
end
|
54
54
|
|
55
55
|
# Check duplicates of the full_name
|
56
|
-
dupl_names =
|
56
|
+
dupl_names = Hash.new(0)
|
57
|
+
each_process do |o|
|
57
58
|
full_name = "#{o[:application]}:#{o[:group]}:#{o[:name]}"
|
58
|
-
|
59
|
+
dupl_names[full_name] += 1
|
59
60
|
end
|
60
61
|
dupl_names = dupl_names.select { |_, v| v > 1 }
|
61
62
|
|
62
|
-
if dupl_names.
|
63
|
+
if dupl_names.any?
|
63
64
|
raise Eye::Dsl::Error, "duplicate names: #{dupl_names.inspect}"
|
64
65
|
end
|
65
66
|
|
66
67
|
# validate processes with their own validate
|
67
|
-
|
68
|
+
each_process do |process_cfg|
|
68
69
|
Eye::Process.validate process_cfg, validate_apps.include?(process_cfg[:application])
|
69
70
|
end
|
70
71
|
|
@@ -73,10 +74,8 @@ class Eye::Config
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def transform!
|
76
|
-
all_processes = processes
|
77
|
-
|
78
77
|
# transform syslog option
|
79
|
-
|
78
|
+
each_process do |process|
|
80
79
|
out = process[:stdout] && process[:stdout].start_with?(':syslog')
|
81
80
|
err = process[:stderr] && process[:stderr].start_with?(':syslog')
|
82
81
|
next unless err || out
|
@@ -95,8 +94,12 @@ class Eye::Config
|
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
98
|
-
def
|
99
|
-
applications.
|
97
|
+
def each_process(&block)
|
98
|
+
applications.each_value do |app_cfg|
|
99
|
+
(app_cfg[:groups] || {}).each_value do |gr_cfg|
|
100
|
+
(gr_cfg[:processes] || {}).each_value(&block)
|
101
|
+
end
|
102
|
+
end
|
100
103
|
end
|
101
104
|
|
102
105
|
def application_names
|
data/lib/eye/controller.rb
CHANGED
data/lib/eye/controller/load.rb
CHANGED
@@ -78,11 +78,7 @@ private
|
|
78
78
|
# return: result, config
|
79
79
|
def parse_config(filename)
|
80
80
|
debug { "parsing: #{filename}" }
|
81
|
-
|
82
|
-
cfg = Eye::Dsl.parse(nil, filename)
|
83
|
-
@current_config.merge(cfg).validate! # just validate summary config here
|
84
|
-
Eye.parsed_config = nil # remove link on config, for better gc
|
85
|
-
cfg
|
81
|
+
Eye::Dsl.parse(nil, filename)
|
86
82
|
end
|
87
83
|
|
88
84
|
# !!! exclusive operation
|
data/lib/eye/dsl.rb
CHANGED
data/lib/eye/process/system.rb
CHANGED
@@ -61,9 +61,7 @@ module Eye::Process::System
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def process_pid_running?(pid)
|
64
|
-
|
65
|
-
debug { "process_really_running?: <#{pid}> #{res.inspect}" }
|
66
|
-
!!res[:result]
|
64
|
+
Eye::System.pid_alive?(pid)
|
67
65
|
end
|
68
66
|
|
69
67
|
def send_signal(code)
|
data/lib/eye/system.rb
CHANGED
@@ -25,8 +25,12 @@ module Eye::System
|
|
25
25
|
# very fast
|
26
26
|
# return true/false
|
27
27
|
def pid_alive?(pid)
|
28
|
-
|
29
|
-
|
28
|
+
if pid
|
29
|
+
::Process.kill(0, pid)
|
30
|
+
true
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
false
|
30
34
|
end
|
31
35
|
|
32
36
|
# Send signal to process (uses for kill)
|
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'
|
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-
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -469,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
469
469
|
version: 1.3.6
|
470
470
|
requirements: []
|
471
471
|
rubyforge_project:
|
472
|
-
rubygems_version: 2.4.
|
472
|
+
rubygems_version: 2.4.5
|
473
473
|
signing_key:
|
474
474
|
specification_version: 4
|
475
475
|
summary: Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI)
|