prometheus-splash 0.8.0 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -3
- data/README.md +400 -178
- data/config/splash.yml +28 -14
- data/lib/splash/backends.rb +7 -1
- data/lib/splash/backends/file.rb +1 -1
- data/lib/splash/cli/commands.rb +122 -37
- data/lib/splash/cli/config.rb +12 -1
- data/lib/splash/cli/daemon.rb +1 -1
- data/lib/splash/cli/logs.rb +144 -48
- data/lib/splash/cli/process.rb +145 -52
- data/lib/splash/cli/transfers.rb +10 -3
- data/lib/splash/commands.rb +115 -40
- data/lib/splash/config.rb +112 -29
- data/lib/splash/config/flush.rb +2 -2
- data/lib/splash/constants.rb +3 -4
- data/lib/splash/daemon/orchestrator.rb +6 -7
- data/lib/splash/daemon/orchestrator/grammar.rb +1 -1
- data/lib/splash/dependencies.rb +1 -0
- data/lib/splash/exiter.rb +1 -1
- data/lib/splash/helpers.rb +1 -1
- data/lib/splash/logs.rb +94 -16
- data/lib/splash/monkeys.rb +5 -0
- data/lib/splash/processes.rb +91 -16
- data/lib/splash/sequences.rb +6 -1
- data/lib/splash/transfers.rb +13 -8
- data/lib/splash/webadmin/api/routes/commands.rb +15 -3
- data/lib/splash/webadmin/api/routes/config.rb +140 -2
- data/lib/splash/webadmin/api/routes/logs.rb +32 -17
- data/lib/splash/webadmin/api/routes/process.rb +21 -9
- data/lib/splash/webadmin/api/routes/sequences.rb +2 -2
- data/lib/splash/webadmin/main.rb +15 -1
- data/lib/splash/webadmin/portal/controllers/commands.rb +101 -1
- data/lib/splash/webadmin/portal/controllers/documentation.rb +2 -0
- data/lib/splash/webadmin/portal/controllers/home.rb +6 -1
- data/lib/splash/webadmin/portal/controllers/logs.rb +71 -1
- data/lib/splash/webadmin/portal/controllers/processes.rb +75 -3
- data/lib/splash/webadmin/portal/controllers/proxy.rb +2 -1
- data/lib/splash/webadmin/portal/controllers/restclient.rb +6 -1
- data/lib/splash/webadmin/portal/controllers/sequences.rb +2 -0
- data/lib/splash/webadmin/portal/public/css/ultragreen.css +6 -0
- data/lib/splash/webadmin/portal/public/favicon.ico +0 -0
- data/lib/splash/webadmin/portal/views/command_form.slim +45 -0
- data/lib/splash/webadmin/portal/views/command_history.slim +27 -0
- data/lib/splash/webadmin/portal/views/commands.slim +70 -20
- data/lib/splash/webadmin/portal/views/documentation.slim +1 -1
- data/lib/splash/webadmin/portal/views/home.slim +19 -20
- data/lib/splash/webadmin/portal/views/layout.slim +2 -2
- data/lib/splash/webadmin/portal/views/log_form.slim +27 -0
- data/lib/splash/webadmin/portal/views/log_history.slim +24 -0
- data/lib/splash/webadmin/portal/views/logs.slim +95 -21
- data/lib/splash/webadmin/portal/views/nav.slim +1 -1
- data/lib/splash/webadmin/portal/views/not_found.slim +1 -1
- data/lib/splash/webadmin/portal/views/process_form.slim +24 -0
- data/lib/splash/webadmin/portal/views/process_history.slim +24 -0
- data/lib/splash/webadmin/portal/views/processes.slim +80 -7
- data/lib/splash/webadmin/portal/views/proxy.slim +2 -2
- data/lib/splash/webadmin/portal/views/restclient.slim +7 -4
- data/lib/splash/webadmin/portal/views/restclient_result.slim +24 -20
- data/lib/splash/webadmin/portal/views/sequences.slim +1 -1
- data/prometheus-splash.gemspec +4 -4
- data/ultragreen_roodi_coding_convention.yml +4 -4
- metadata +18 -10
data/lib/splash/sequences.rb
CHANGED
@@ -25,12 +25,17 @@ module Splash
|
|
25
25
|
list[name][:definition].each do |step|
|
26
26
|
log.info "STEP : #{step[:step]}",session
|
27
27
|
if step[:on_host].nil? then
|
28
|
-
|
28
|
+
if get_config.commands.select{|cmd| cmd[:name] == step[:command]}.count > 0 then
|
29
|
+
command = CommandWrapper::new(step[:command].to_s)
|
29
30
|
step[:callback] = true if step[:callback].nil?
|
30
31
|
step[:trace] = true if step[:trace].nil?
|
31
32
|
step[:notify] = true if step[:notify].nil?
|
32
33
|
step[:session] = session
|
33
34
|
acase = command.call_and_notify step
|
35
|
+
else
|
36
|
+
log.error "Commmand #{step[:command]} not found, for STEP : #{step[:step]}", session
|
37
|
+
acase = splash_return :not_found
|
38
|
+
end
|
34
39
|
else
|
35
40
|
log.info "Remote execution of #{step[:command]} on #{step[:on_host]}", session
|
36
41
|
begin
|
data/lib/splash/transfers.rb
CHANGED
@@ -49,40 +49,45 @@ module Splash
|
|
49
49
|
|
50
50
|
class TxRecords
|
51
51
|
include Splash::Backends
|
52
|
+
include Splash::Constants
|
53
|
+
|
52
54
|
def initialize(name)
|
53
55
|
@name = name
|
54
|
-
@backend = get_backend :
|
56
|
+
@backend = get_backend :transfers_trace
|
55
57
|
end
|
56
58
|
|
57
59
|
def purge(retention)
|
60
|
+
retention = {} if retention.nil?
|
58
61
|
if retention.include? :hours then
|
59
62
|
adjusted_datetime = DateTime.now - retention[:hours].to_f / 24
|
60
63
|
elsif retention.include? :hours then
|
61
64
|
adjusted_datetime = DateTime.now - retention[:days].to_i
|
62
65
|
else
|
63
|
-
|
66
|
+
adjusted_datetime = DateTime.now - DEFAULT_RETENTION
|
64
67
|
end
|
65
68
|
|
66
69
|
data = get_all_records
|
67
70
|
|
68
|
-
data.delete_if { |item
|
69
|
-
DateTime.parse(item) <= (adjusted_datetime)
|
71
|
+
data.delete_if { |item|
|
72
|
+
DateTime.parse(item.keys.first) <= (adjusted_datetime)}
|
70
73
|
@backend.put key: @name, value: data.to_yaml
|
71
74
|
end
|
72
75
|
|
73
76
|
def add_record(record)
|
74
77
|
data = get_all_records
|
75
|
-
data
|
78
|
+
data.push({ DateTime.now.to_s => record })
|
76
79
|
@backend.put key: @name, value: data.to_yaml
|
77
80
|
end
|
78
81
|
|
79
|
-
def get_all_records
|
80
|
-
return (@backend.exist?({key: @name}))? YAML::load(@backend.get({key: @name})) :
|
82
|
+
def get_all_records(options={})
|
83
|
+
return (@backend.exist?({key: @name}))? YAML::load(@backend.get({key: @name})) : []
|
81
84
|
end
|
82
85
|
|
83
86
|
def check_prepared
|
84
87
|
return :never_run_prepare unless @backend.exist?({key: @name})
|
85
|
-
return :never_prepare unless YAML::load(@backend.get({key: @name})).select {|item
|
88
|
+
return :never_prepare unless YAML::load(@backend.get({key: @name})).select {|item|
|
89
|
+
record =item.keys.first
|
90
|
+
value=item[record]
|
86
91
|
value[:status] == :prepared
|
87
92
|
}.count > 0
|
88
93
|
return :prepared
|
@@ -5,7 +5,7 @@
|
|
5
5
|
WebAdminApp.get '/api/commands/list.?:format?' do
|
6
6
|
log = get_logger
|
7
7
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
8
|
-
log.call "
|
8
|
+
log.call "API : commands, verb : GET, route : list, format : #{format}"
|
9
9
|
obj = splash_return case: :quiet_exit, :more => "Commands list"
|
10
10
|
obj[:data] = get_config.commands
|
11
11
|
content_type format
|
@@ -15,8 +15,8 @@ WebAdminApp.get '/api/commands/list.?:format?' do
|
|
15
15
|
WebAdminApp.get '/api/commands/show/:name.?:format?' do
|
16
16
|
log = get_logger
|
17
17
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
18
|
-
log.call "
|
19
|
-
commands_recordset = get_config.commands[params[:name].to_sym
|
18
|
+
log.call "API : commands, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
19
|
+
commands_recordset = get_config.commands.select {|command| command[:name] == params[:name].to_sym}.first
|
20
20
|
unless commands_recordset.nil? then
|
21
21
|
obj = splash_return case: :quiet_exit
|
22
22
|
obj[:data] = commands_recordset
|
@@ -26,3 +26,15 @@ WebAdminApp.get '/api/commands/show/:name.?:format?' do
|
|
26
26
|
content_type format
|
27
27
|
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
28
28
|
end
|
29
|
+
|
30
|
+
WebAdminApp.get '/api/commands/history/:name.?:format?' do
|
31
|
+
log = get_logger
|
32
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
33
|
+
log.call "API : commands, verb : GET, route : history, format : #{format}"
|
34
|
+
record = Splash::Commands::CmdRecords::new(params[:name]).get_all_records
|
35
|
+
history = splash_return case: :quiet_exit, :more => "command monitoring history"
|
36
|
+
history[:data] = record
|
37
|
+
content_type format
|
38
|
+
status 201
|
39
|
+
format_response(history, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
40
|
+
end
|
@@ -1,10 +1,148 @@
|
|
1
1
|
WebAdminApp.get '/api/config/full.?:format?' do
|
2
2
|
log = get_logger
|
3
3
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
4
|
-
log.call "
|
4
|
+
log.call "API : config, verb : GET, route : full, format : #{format}"
|
5
5
|
config = get_config.full
|
6
|
-
obj = splash_return case: :quiet_exit, :more => "
|
6
|
+
obj = splash_return case: :quiet_exit, :more => "Show internal Splash Config"
|
7
7
|
obj[:data] = config
|
8
8
|
content_type format
|
9
9
|
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
10
10
|
end
|
11
|
+
|
12
|
+
WebAdminApp.get '/api/config/fromfile.?:format?' do
|
13
|
+
log = get_logger
|
14
|
+
fromfile = {}
|
15
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
16
|
+
log.call "API : config, verb : GET, route : fromfile, format : #{format}"
|
17
|
+
config = get_config.config_from_file
|
18
|
+
fromfile = splash_return case: :quiet_exit, :more => "Show config from file"
|
19
|
+
fromfile[:data] = config
|
20
|
+
content_type format
|
21
|
+
format_response(fromfile, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
WebAdminApp.post '/api/config/addlog.?:format?' do
|
26
|
+
log = get_logger
|
27
|
+
addlog = {}
|
28
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
29
|
+
log.call "API : config, verb : POST, route : addlog, format : #{format}"
|
30
|
+
res = get_config.add_record :record => YAML::load(request.body.read), :key => :label, :type => :logs, :clean => true
|
31
|
+
case res[:status]
|
32
|
+
when :success
|
33
|
+
rehash_daemon
|
34
|
+
addlog = splash_return case: :quiet_exit, :more => "add log done"
|
35
|
+
when :already_exist
|
36
|
+
addlog = splash_return case: :already_exist, :more => "add log twice nto allowed"
|
37
|
+
when :failure
|
38
|
+
addlog = splash_return case: :configuration_error, :more => "add log failed"
|
39
|
+
addlog[:data] = res
|
40
|
+
end
|
41
|
+
content_type format
|
42
|
+
format_response(addlog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
43
|
+
end
|
44
|
+
|
45
|
+
WebAdminApp.post '/api/config/addprocess.?:format?' do
|
46
|
+
log = get_logger
|
47
|
+
addprocess = {}
|
48
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
49
|
+
log.call "API : config, verb : POST, route : addprocess, format : #{format}"
|
50
|
+
res = get_config.add_record :record => YAML::load(request.body.read), :type => :processes, :key => :process, :clean => true
|
51
|
+
case res[:status]
|
52
|
+
when :success
|
53
|
+
rehash_daemon
|
54
|
+
addprocess = splash_return case: :quiet_exit, :more => "add process done"
|
55
|
+
when :already_exist
|
56
|
+
addprocess = splash_return case: :already_exist, :more => "add process twice not allowed"
|
57
|
+
when :failure
|
58
|
+
addprocess = splash_return case: :configuration_error, :more => "add process failed"
|
59
|
+
addprocess[:data] = res
|
60
|
+
end
|
61
|
+
content_type format
|
62
|
+
format_response(addprocess, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
63
|
+
end
|
64
|
+
|
65
|
+
WebAdminApp.post '/api/config/addcommand.?:format?' do
|
66
|
+
log = get_logger
|
67
|
+
addcommand = {}
|
68
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
69
|
+
log.call "API : config, verb : POST, route : addcommand, format : #{format}"
|
70
|
+
res = get_config.add_record :record => YAML::load(request.body.read), :type => :commands, :key => :name, :clean => true
|
71
|
+
case res[:status]
|
72
|
+
when :success
|
73
|
+
rehash_daemon
|
74
|
+
addcommand = splash_return case: :quiet_exit, :more => "add command done"
|
75
|
+
when :already_exist
|
76
|
+
addcommand = splash_return case: :already_exist, :more => "add command twice not allowed"
|
77
|
+
when :failure
|
78
|
+
addpraddcommandocess = splash_return case: :configuration_error, :more => "add command failed"
|
79
|
+
addcommand[:data] = res
|
80
|
+
end
|
81
|
+
content_type format
|
82
|
+
format_response(addcommand, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
WebAdminApp.delete '/api/config/deletelog/:label.?:format?' do
|
88
|
+
log = get_logger
|
89
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
90
|
+
log.call "API : config, verb : DELETE, route : deletelog, format : #{format}"
|
91
|
+
deletelog = {}
|
92
|
+
logsrec = Splash::Logs::LogsRecords::new params[:label].to_sym
|
93
|
+
logsrec.clear
|
94
|
+
res = get_config.delete_record :type => :logs, key: :label, label: params[:label].to_sym
|
95
|
+
case res[:status]
|
96
|
+
when :success
|
97
|
+
rehash_daemon
|
98
|
+
deletelog = splash_return case: :quiet_exit, :more => "delete log done"
|
99
|
+
when :not_found
|
100
|
+
deletelog = splash_return case: :not_found, :more => "nothing done for logs"
|
101
|
+
else
|
102
|
+
deletelog = splash_return case: :configuration_error, :more => "delete log failed"
|
103
|
+
end
|
104
|
+
content_type format
|
105
|
+
format_response(deletelog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
106
|
+
end
|
107
|
+
|
108
|
+
WebAdminApp.delete '/api/config/deleteprocess/:process.?:format?' do
|
109
|
+
log = get_logger
|
110
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
111
|
+
log.call "API : config, verb : DELETE, route : deleteprocess, format : #{format}"
|
112
|
+
deleteprocess = {}
|
113
|
+
procrec = Splash::Processes::ProcessRecords::new params[:process].to_sym
|
114
|
+
procrec.clear
|
115
|
+
res = get_config.delete_record :type => :processes, :key => :process, process: params[:process].to_sym
|
116
|
+
case res[:status]
|
117
|
+
when :success
|
118
|
+
rehash_daemon
|
119
|
+
deleteprocess = splash_return case: :quiet_exit, :more => "delete process done"
|
120
|
+
when :not_found
|
121
|
+
deleteprocess = splash_return case: :not_found, :more => "nothing done for processes"
|
122
|
+
else
|
123
|
+
deleteprocess = splash_return case: :configuration_error, :more => "delete process failed"
|
124
|
+
end
|
125
|
+
content_type format
|
126
|
+
format_response(deleteprocess, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
127
|
+
end
|
128
|
+
|
129
|
+
WebAdminApp.delete '/api/config/deletecommand/:command.?:format?' do
|
130
|
+
log = get_logger
|
131
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
132
|
+
log.call "API : config, verb : DELETE, route : deletecommand, format : #{format}"
|
133
|
+
deletecommand = {}
|
134
|
+
cmdrec = Splash::Commands::CmdRecords::new params[:command].to_sym
|
135
|
+
cmdrec.clear
|
136
|
+
res = get_config.delete_record :type => :commands, :key => :name, name: params[:command].to_sym
|
137
|
+
case res[:status]
|
138
|
+
when :success
|
139
|
+
rehash_daemon
|
140
|
+
deletecommand = splash_return case: :quiet_exit, :more => "delete command done"
|
141
|
+
when :not_found
|
142
|
+
deletecommand = splash_return case: :not_found, :more => "nothing done for commands"
|
143
|
+
else
|
144
|
+
deletecommand = splash_return case: :configuration_error, :more => "delete command failed"
|
145
|
+
end
|
146
|
+
content_type format
|
147
|
+
format_response(deletecommand, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
148
|
+
end
|
@@ -4,56 +4,71 @@
|
|
4
4
|
|
5
5
|
WebAdminApp.get '/api/logs/list.?:format?' do
|
6
6
|
log = get_logger
|
7
|
+
list = {}
|
7
8
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
8
|
-
log.call "
|
9
|
+
log.call "API : logs, verb : GET, route : list, format : #{format}"
|
9
10
|
logs_recordset = get_config.logs
|
10
|
-
|
11
|
-
|
11
|
+
list = splash_return case: :quiet_exit, :more => "logs list"
|
12
|
+
list[:data] = logs_recordset
|
12
13
|
content_type format
|
13
|
-
format_response(
|
14
|
+
format_response(list, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
14
15
|
end
|
15
16
|
|
16
17
|
WebAdminApp.get '/api/logs/show/:name.?:format?' do
|
17
18
|
log = get_logger
|
18
19
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
19
|
-
log.call "
|
20
|
+
log.call "API : logs, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
20
21
|
logs_recordset = get_config.logs.select{|item| item[:label] == params[:name].to_sym }
|
22
|
+
show = {}
|
21
23
|
unless logs_recordset.empty? then
|
22
24
|
record = logs_recordset.first
|
23
|
-
|
24
|
-
|
25
|
+
show = splash_return case: :quiet_exit
|
26
|
+
show[:data] = record
|
27
|
+
status 201
|
25
28
|
else
|
26
|
-
|
29
|
+
show = splash_return case: :not_found, :more => "logs not configured"
|
27
30
|
end
|
28
|
-
format_response(
|
31
|
+
format_response(show, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
29
32
|
end
|
30
33
|
|
31
34
|
WebAdminApp.post '/api/logs/analyse.?:format?' do
|
32
35
|
log = get_logger
|
33
36
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
34
|
-
log.call "
|
37
|
+
log.call "API : logs, verb : POST, route : analyse, format : #{format}"
|
35
38
|
results = Splash::Logs::LogScanner::new
|
36
39
|
results.analyse
|
37
40
|
res = results.output
|
38
|
-
|
39
|
-
|
41
|
+
analyse = splash_return case: :quiet_exit, :more => "logs analyse report"
|
42
|
+
analyse[:data] = res
|
40
43
|
status 201
|
41
44
|
content_type format
|
42
|
-
format_response(
|
45
|
+
format_response(analyse, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
43
46
|
end
|
44
47
|
|
45
48
|
WebAdminApp.post '/api/logs/monitor.?:format?' do
|
46
49
|
log = get_logger
|
47
50
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
48
|
-
log.call "
|
51
|
+
log.call "API : logs, verb : POST, route : monitor, format : #{format}"
|
49
52
|
results = Splash::Logs::LogScanner::new
|
50
53
|
results.analyse
|
51
|
-
|
52
|
-
if
|
54
|
+
monitor = splash_return results.notify
|
55
|
+
if monitor[:status] == :failure then
|
53
56
|
status 503
|
54
57
|
else
|
55
58
|
status 201
|
56
59
|
end
|
57
60
|
content_type format
|
58
|
-
format_response(
|
61
|
+
format_response(monitor, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
62
|
+
end
|
63
|
+
|
64
|
+
WebAdminApp.get '/api/logs/history/:label.?:format?' do
|
65
|
+
log = get_logger
|
66
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
67
|
+
log.call "API : logs, verb : GET, route : history, format : #{format}"
|
68
|
+
record = Splash::Logs::LogsRecords::new(params[:label]).get_all_records
|
69
|
+
history = splash_return case: :quiet_exit, :more => "log monitoring history"
|
70
|
+
history[:data] = record
|
71
|
+
content_type format
|
72
|
+
status 201
|
73
|
+
format_response(history, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
59
74
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
WebAdminApp.get '/api/
|
5
|
+
WebAdminApp.get '/api/processes/list.?:format?' do
|
6
6
|
log = get_logger
|
7
7
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
8
|
-
log.call "
|
8
|
+
log.call "API : processes, verb : GET, route : list, format : #{format}"
|
9
9
|
process_recordset = get_config.processes
|
10
10
|
obj = splash_return case: :quiet_exit, :more => "Processes list"
|
11
11
|
obj[:data] = process_recordset
|
@@ -13,11 +13,11 @@ WebAdminApp.get '/api/process/list.?:format?' do
|
|
13
13
|
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
14
14
|
end
|
15
15
|
|
16
|
-
WebAdminApp.get '/api/
|
16
|
+
WebAdminApp.get '/api/processes/show/:name.?:format?' do
|
17
17
|
log = get_logger
|
18
18
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
19
|
-
log.call "
|
20
|
-
process_recordset = get_config.processes.select{|item| item[:process] == params[:name] }
|
19
|
+
log.call "API : processes, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
20
|
+
process_recordset = get_config.processes.select{|item| item[:process] == params[:name].to_sym }
|
21
21
|
unless process_recordset.empty? then
|
22
22
|
record = process_recordset.first
|
23
23
|
obj = splash_return case: :quiet_exit
|
@@ -29,10 +29,10 @@ WebAdminApp.get '/api/process/show/:name.?:format?' do
|
|
29
29
|
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
30
30
|
end
|
31
31
|
|
32
|
-
WebAdminApp.post '/api/
|
32
|
+
WebAdminApp.post '/api/processes/analyse.?:format?' do
|
33
33
|
log = get_logger
|
34
34
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
35
|
-
log.call "
|
35
|
+
log.call "API : processes, verb : POST, route : analyse, format : #{format}"
|
36
36
|
results = Splash::Processes::ProcessScanner::new
|
37
37
|
results.analyse
|
38
38
|
res = results.output
|
@@ -43,10 +43,10 @@ WebAdminApp.post '/api/process/analyse.?:format?' do
|
|
43
43
|
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
44
44
|
end
|
45
45
|
|
46
|
-
WebAdminApp.post '/api/
|
46
|
+
WebAdminApp.post '/api/processes/monitor.?:format?' do
|
47
47
|
log = get_logger
|
48
48
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
49
|
-
log.call "
|
49
|
+
log.call "API : processes, verb : POST, route : monitor, format : #{format}"
|
50
50
|
results = Splash::Processes::ProcessScanner::new
|
51
51
|
results.analyse
|
52
52
|
res = splash_return results.notify
|
@@ -58,3 +58,15 @@ WebAdminApp.post '/api/process/monitor.?:format?' do
|
|
58
58
|
content_type format
|
59
59
|
format_response(res, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
60
60
|
end
|
61
|
+
|
62
|
+
WebAdminApp.get '/api/processes/history/:process.?:format?' do
|
63
|
+
log = get_logger
|
64
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
65
|
+
log.call "API : processes, verb : GET, route : history, format : #{format}"
|
66
|
+
record = Splash::Processes::ProcessRecords::new(params[:process]).get_all_records
|
67
|
+
history = splash_return case: :quiet_exit, :more => "Proces monitoring history"
|
68
|
+
history[:data] = record
|
69
|
+
content_type format
|
70
|
+
status 201
|
71
|
+
format_response(history, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
72
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
WebAdminApp.get '/api/sequences/list.?:format?' do
|
6
6
|
log = get_logger
|
7
7
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
8
|
-
log.call "
|
8
|
+
log.call "API : sequences, verb : GET, route : list, format : #{format}"
|
9
9
|
obj = splash_return case: :quiet_exit, :more => "Sequences list"
|
10
10
|
obj[:data] = get_config.sequences
|
11
11
|
content_type format
|
@@ -15,7 +15,7 @@ WebAdminApp.get '/api/sequences/list.?:format?' do
|
|
15
15
|
WebAdminApp.get '/api/sequences/show/:name.?:format?' do
|
16
16
|
log = get_logger
|
17
17
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
18
|
-
log.call "
|
18
|
+
log.call "API : sequences, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
19
19
|
sequences_recordset = get_config.sequences[params[:name].to_sym]
|
20
20
|
unless sequences_recordset.nil? then
|
21
21
|
obj = splash_return case: :quiet_exit
|
data/lib/splash/webadmin/main.rb
CHANGED
@@ -7,6 +7,9 @@ class WebAdminApp < Sinatra::Base
|
|
7
7
|
include Splash::Exiter
|
8
8
|
include Splash::Loggers
|
9
9
|
include Splash::Daemon::Controller
|
10
|
+
include Splash::Logs
|
11
|
+
include Splash::Processes
|
12
|
+
include Splash::Transports
|
10
13
|
|
11
14
|
set :server, 'thin'
|
12
15
|
set :port, get_config.webadmin_port
|
@@ -19,7 +22,18 @@ class WebAdminApp < Sinatra::Base
|
|
19
22
|
rehash_config
|
20
23
|
end
|
21
24
|
|
22
|
-
|
25
|
+
def rehash_daemon
|
26
|
+
status = get_processes({ :pattern => get_config.daemon_process_name}).empty?
|
27
|
+
if status == false then
|
28
|
+
transport = get_default_client
|
29
|
+
unless transport.class == Hash and transport.include? :case then
|
30
|
+
transport.publish queue: "splash.#{Socket.gethostname}.input",
|
31
|
+
message: { :verb => :reset,
|
32
|
+
:return_to => :ignore,
|
33
|
+
:queue => "splash.#{Socket.gethostname}.input" }.to_yaml
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
23
37
|
|
24
38
|
end
|
25
39
|
|