eye 0.4.2 → 0.5
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/.gitignore +2 -0
- data/.travis.yml +4 -0
- data/CHANGES.md +11 -0
- data/README.md +3 -3
- data/Rakefile +8 -0
- data/bin/eye +0 -316
- data/bin/loader_eye +3 -3
- data/examples/test.eye +2 -2
- data/eye.gemspec +4 -9
- data/lib/eye.rb +4 -2
- data/lib/eye/application.rb +3 -3
- data/lib/eye/checker.rb +14 -5
- data/lib/eye/checker/cputime.rb +23 -0
- data/lib/eye/checker/file_touched.rb +15 -0
- data/lib/eye/checker/http.rb +7 -9
- data/lib/eye/checker/memory.rb +1 -1
- data/lib/eye/checker/runtime.rb +28 -0
- data/lib/eye/checker/socket.rb +4 -4
- data/lib/eye/cli.rb +166 -0
- data/lib/eye/cli/commands.rb +79 -0
- data/lib/eye/cli/render.rb +137 -0
- data/lib/eye/cli/server.rb +85 -0
- data/lib/eye/client.rb +3 -3
- data/lib/eye/config.rb +17 -14
- data/lib/eye/controller.rb +6 -10
- data/lib/eye/controller/commands.rb +6 -10
- data/lib/eye/controller/helpers.rb +1 -1
- data/lib/eye/controller/send_command.rb +5 -2
- data/lib/eye/controller/status.rb +37 -105
- data/lib/eye/dsl.rb +1 -1
- data/lib/eye/dsl/application_opts.rb +6 -2
- data/lib/eye/dsl/child_process_opts.rb +3 -2
- data/lib/eye/dsl/config_opts.rb +2 -2
- data/lib/eye/dsl/group_opts.rb +2 -1
- data/lib/eye/dsl/main.rb +4 -2
- data/lib/eye/dsl/opts.rb +11 -4
- data/lib/eye/dsl/validation.rb +49 -43
- data/lib/eye/group.rb +1 -1
- data/lib/eye/loader.rb +5 -9
- data/lib/eye/{settings.rb → local.rb} +1 -1
- data/lib/eye/logger.rb +5 -0
- data/lib/eye/notify.rb +12 -6
- data/lib/eye/notify/jabber.rb +2 -2
- data/lib/eye/process/child.rb +3 -1
- data/lib/eye/process/commands.rb +2 -2
- data/lib/eye/process/controller.rb +1 -1
- data/lib/eye/process/trigger.rb +1 -1
- data/lib/eye/sigar.rb +5 -0
- data/lib/eye/system.rb +7 -6
- data/lib/eye/system_resources.rb +46 -41
- data/lib/eye/trigger.rb +15 -8
- data/lib/eye/trigger/flapping.rb +1 -1
- data/lib/eye/trigger/stop_childs.rb +1 -1
- data/lib/eye/trigger/transition.rb +15 -0
- data/lib/eye/utils.rb +12 -0
- data/lib/eye/utils/leak_19.rb +7 -0
- data/lib/eye/utils/mini_active_support.rb +106 -0
- metadata +24 -15
- data/lib/eye/controller/show_history.rb +0 -63
- data/lib/eye/trigger/state.rb +0 -11
@@ -1,63 +0,0 @@
|
|
1
|
-
module Eye::Controller::ShowHistory
|
2
|
-
|
3
|
-
def history_string(*args)
|
4
|
-
data = history_data(*args)
|
5
|
-
|
6
|
-
res = []
|
7
|
-
data.each do |name, data|
|
8
|
-
res << detail_process_info(name, data)
|
9
|
-
end
|
10
|
-
|
11
|
-
res * "\n"
|
12
|
-
end
|
13
|
-
|
14
|
-
def history_data(*args)
|
15
|
-
res = {}
|
16
|
-
get_processes_for_history(*args).each do |process|
|
17
|
-
res[process.full_name] = process.schedule_history.reject{|c| c[:state] == :check_crash }
|
18
|
-
end
|
19
|
-
res
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def get_processes_for_history(*args)
|
25
|
-
args = ['*'] if args.empty?
|
26
|
-
res = []
|
27
|
-
matched_objects(*args) do |obj|
|
28
|
-
if (obj.is_a?(Eye::Process) || obj.is_a?(Eye::ChildProcess))
|
29
|
-
res << obj
|
30
|
-
else
|
31
|
-
res += obj.processes.to_a
|
32
|
-
end
|
33
|
-
end
|
34
|
-
Eye::Utils::AliveArray.new(res)
|
35
|
-
end
|
36
|
-
|
37
|
-
def detail_process_info(name, history)
|
38
|
-
return if history.empty?
|
39
|
-
|
40
|
-
res = "\033[1m#{name}\033[0m:\n"
|
41
|
-
history = history.reverse
|
42
|
-
|
43
|
-
history.chunk{|h| [h[:state], h[:reason].to_s] }.each do |_, hist|
|
44
|
-
if hist.size >= 3
|
45
|
-
res << detail_process_info_string(hist[0])
|
46
|
-
res << detail_process_info_string(:state => "... #{hist.size - 2} times", :reason => '...', :at => hist[-1][:at])
|
47
|
-
res << detail_process_info_string(hist[-1])
|
48
|
-
else
|
49
|
-
hist.each do |h|
|
50
|
-
res << detail_process_info_string(h)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
res
|
56
|
-
end
|
57
|
-
|
58
|
-
def detail_process_info_string(h)
|
59
|
-
state = h[:state].to_s.ljust(14)
|
60
|
-
"#{Time.at(h[:at]).to_s(:db)} - #{state} (#{h[:reason]})\n"
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|