prometheus-splash 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/README.md +1 -1
- data/lib/splash/cli/logs.rb +3 -0
- data/lib/splash/config.rb +105 -29
- data/lib/splash/constants.rb +1 -2
- data/lib/splash/exiter.rb +1 -1
- data/lib/splash/helpers.rb +1 -1
- data/lib/splash/webadmin/api/routes/commands.rb +2 -2
- data/lib/splash/webadmin/api/routes/config.rb +53 -2
- data/lib/splash/webadmin/api/routes/logs.rb +32 -17
- data/lib/splash/webadmin/api/routes/process.rb +4 -4
- data/lib/splash/webadmin/api/routes/sequences.rb +2 -2
- data/lib/splash/webadmin/portal/controllers/commands.rb +2 -0
- 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 +44 -1
- data/lib/splash/webadmin/portal/controllers/processes.rb +2 -0
- 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/commands.slim +1 -1
- 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/logs.slim +68 -21
- data/lib/splash/webadmin/portal/views/logs_form.slim +24 -0
- 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/processes.slim +1 -1
- 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
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1089bb88ba3cb916cae48b6253559c5542028ab7752d9c08d5a90cb95a45c9f
|
4
|
+
data.tar.gz: 90280e53cbf7124b191707fd089afcd48f29bbf68d332fc2acc7865efc2f70b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c50f695e45c368955df4c919faa179c32ae333ce9d0e5676e9da0b1497893d08c526a2ba0a07fdaa7172972831fa43e7a16522404e112d1fdae156a1dfc2fbac
|
7
|
+
data.tar.gz: c8923535e3af5102bb02c3571cc29a220d83a02e2aa71885ab6022800ad3144361e583302de6021d690922c8f49c503a0e5eb3198cb1e7fa745377727462dae8
|
data/CHANGELOG.md
CHANGED
@@ -151,7 +151,14 @@
|
|
151
151
|
* reshash config and reset + grammar and Cli
|
152
152
|
* refacto config
|
153
153
|
|
154
|
-
##
|
154
|
+
## V 0.8.1
|
155
155
|
|
156
156
|
### FEATURE
|
157
|
-
*
|
157
|
+
* full Web UI features for Logs (R/W)
|
158
|
+
* API Logs Full
|
159
|
+
|
160
|
+
## V 0.8.2
|
161
|
+
|
162
|
+
### FIX
|
163
|
+
* WebAdmin UI bugs and cosmetics
|
164
|
+
* API (constants CLONE for exiter)
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ SPLASH is **Supervision with Prometheus of Logs and Asynchronous tasks orchestra
|
|
9
9
|
* Web : http://www.ultragreen.net
|
10
10
|
* Github : https://github.com/Ultragreen/prometheus-splash
|
11
11
|
* Rubygems : https://rubygems.org/gems/prometheus-splash
|
12
|
-
* DOC yardoc : https://www.rubydoc.info/gems/prometheus-splash/0.8.
|
12
|
+
* DOC yardoc : https://www.rubydoc.info/gems/prometheus-splash/0.8.2
|
13
13
|
|
14
14
|
Prometheus Logs and Batchs supervision over PushGateway
|
15
15
|
|
data/lib/splash/cli/logs.rb
CHANGED
data/lib/splash/config.rb
CHANGED
@@ -11,58 +11,124 @@ module Splash
|
|
11
11
|
include Splash::ConfigUtilities
|
12
12
|
|
13
13
|
|
14
|
+
class ConfigLinter
|
15
|
+
def initialize
|
16
|
+
@lints_present = {:logs => [:label, :log, :pattern ]}
|
17
|
+
@lints_types = {:logs => {:label => Symbol, :log => String, :pattern => String, :retention => Hash}}
|
18
|
+
end
|
19
|
+
|
20
|
+
def verify(options ={})
|
21
|
+
status = :success
|
22
|
+
missings = []
|
23
|
+
type_errors = []
|
24
|
+
useless = []
|
25
|
+
options[:record].each do |key,value|
|
26
|
+
useless.push key unless @lints_present[options[:type]].include? key or @lints_types[options[:type]].keys.include? key
|
27
|
+
type_errors.push key if @lints_types[options[:type]][key] != value.class and (@lints_present[options[:type]].include? key or @lints_types[options[:type]].keys.include? key)
|
28
|
+
end
|
29
|
+
@lints_present[options[:type]].each do |item|
|
30
|
+
missings.push item unless options[:record].keys.include? item
|
31
|
+
end
|
32
|
+
|
33
|
+
status = :failure if (missings.count > 0) or (type_errors.count > 0)
|
34
|
+
return {:missings => missings, :type_errors => type_errors, :useless => useless, :status => status}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
14
39
|
# Class to manage configuration in Splash from Splash::Constants override by Yaml CONFIG
|
15
40
|
class Configuration < Hash
|
16
41
|
include Splash::Constants
|
17
42
|
|
43
|
+
attr_accessor :config_from_file
|
44
|
+
|
18
45
|
# constructor : read config file and map against Constants
|
19
46
|
def initialize(config_file=CONFIG_FILE)
|
20
|
-
|
47
|
+
@config_file = config_file
|
48
|
+
hash_config_to_default
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def hash_config_to_default
|
54
|
+
@config_from_file = readconf @config_file
|
21
55
|
self[:version] = VERSION
|
22
56
|
self[:author] = "#{AUTHOR} <#{EMAIL}>"
|
23
57
|
self[:copyright] = "#{COPYRIGHT} #{LICENSE}"
|
24
58
|
|
25
|
-
self[:prometheus_url] = (config_from_file[:prometheus][:url])? config_from_file[:prometheus][:url] : PROMETHEUS_URL
|
26
|
-
self[:prometheus_pushgateway_url] = (config_from_file[:prometheus][:pushgateway])? config_from_file[:prometheus][:pushgateway] : PROMETHEUS_PUSHGATEWAY_URL
|
27
|
-
self[:prometheus_alertmanager_url] = (config_from_file[:prometheus][:alertmanager])? config_from_file[:prometheus][:alertmanager] : PROMETHEUS_ALERTMANAGER_URL
|
59
|
+
self[:prometheus_url] = (@config_from_file[:prometheus][:url])? @config_from_file[:prometheus][:url] : PROMETHEUS_URL
|
60
|
+
self[:prometheus_pushgateway_url] = (@config_from_file[:prometheus][:pushgateway])? @config_from_file[:prometheus][:pushgateway] : PROMETHEUS_PUSHGATEWAY_URL
|
61
|
+
self[:prometheus_alertmanager_url] = (@config_from_file[:prometheus][:alertmanager])? @config_from_file[:prometheus][:alertmanager] : PROMETHEUS_ALERTMANAGER_URL
|
28
62
|
|
29
|
-
self[:daemon_process_name] = (config_from_file[:daemon][:process_name])? config_from_file[:daemon][:process_name] : DAEMON_PROCESS_NAME
|
30
|
-
self[:daemon_logmon_scheduling] = (config_from_file[:daemon][:logmon_scheduling])? config_from_file[:daemon][:logmon_scheduling] : DAEMON_LOGMON_SCHEDULING
|
31
|
-
self[:daemon_metrics_scheduling] = (config_from_file[:daemon][:metrics_scheduling])? config_from_file[:daemon][:metrics_scheduling] : DAEMON_METRICS_SCHEDULING
|
32
|
-
self[:daemon_procmon_scheduling] = (config_from_file[:daemon][:procmon_scheduling])? config_from_file[:daemon][:procmon_scheduling] : DAEMON_PROCMON_SCHEDULING
|
33
|
-
self[:daemon_pid_file] = (config_from_file[:daemon][:files][:pid_file])? config_from_file[:daemon][:files][:pid_file] : DAEMON_PID_FILE
|
34
|
-
self[:daemon_stdout_trace] = (config_from_file[:daemon][:files][:stdout_trace])? config_from_file[:daemon][:files][:stdout_trace] : DAEMON_STDOUT_TRACE
|
35
|
-
self[:daemon_stderr_trace] = (config_from_file[:daemon][:files][:stderr_trace])? config_from_file[:daemon][:files][:stderr_trace] : DAEMON_STDERR_TRACE
|
63
|
+
self[:daemon_process_name] = (@config_from_file[:daemon][:process_name])? @config_from_file[:daemon][:process_name] : DAEMON_PROCESS_NAME
|
64
|
+
self[:daemon_logmon_scheduling] = (@config_from_file[:daemon][:logmon_scheduling])? @config_from_file[:daemon][:logmon_scheduling] : DAEMON_LOGMON_SCHEDULING
|
65
|
+
self[:daemon_metrics_scheduling] = (@config_from_file[:daemon][:metrics_scheduling])? @config_from_file[:daemon][:metrics_scheduling] : DAEMON_METRICS_SCHEDULING
|
66
|
+
self[:daemon_procmon_scheduling] = (@config_from_file[:daemon][:procmon_scheduling])? @config_from_file[:daemon][:procmon_scheduling] : DAEMON_PROCMON_SCHEDULING
|
67
|
+
self[:daemon_pid_file] = (@config_from_file[:daemon][:files][:pid_file])? @config_from_file[:daemon][:files][:pid_file] : DAEMON_PID_FILE
|
68
|
+
self[:daemon_stdout_trace] = (@config_from_file[:daemon][:files][:stdout_trace])? @config_from_file[:daemon][:files][:stdout_trace] : DAEMON_STDOUT_TRACE
|
69
|
+
self[:daemon_stderr_trace] = (@config_from_file[:daemon][:files][:stderr_trace])? @config_from_file[:daemon][:files][:stderr_trace] : DAEMON_STDERR_TRACE
|
36
70
|
|
37
71
|
|
38
|
-
self[:webadmin_port] = (config_from_file[:webadmin][:port])? config_from_file[:webadmin][:port] : WEBADMIN_PORT
|
39
|
-
self[:webadmin_ip] = (config_from_file[:webadmin][:ip])? config_from_file[:webadmin][:ip] : WEBADMIN_IP
|
40
|
-
self[:webadmin_proxy] = (config_from_file[:webadmin][:proxy])? config_from_file[:webadmin][:proxy] : WEBADMIN_PROXY
|
41
|
-
self[:webadmin_process_name] = (config_from_file[:webadmin][:process_name])? config_from_file[:webadmin][:process_name] : WEBADMIN_PROCESS_NAME
|
42
|
-
self[:webadmin_pid_file] = (config_from_file[:webadmin][:files][:pid_file])? config_from_file[:webadmin][:files][:pid_file] : WEBADMIN_PID_FILE
|
43
|
-
self[:webadmin_stdout_trace] = (config_from_file[:webadmin][:files][:stdout_trace])? config_from_file[:webadmin][:files][:stdout_trace] : WEBADMIN_STDOUT_TRACE
|
44
|
-
self[:webadmin_stderr_trace] = (config_from_file[:webadmin][:files][:stderr_trace])? config_from_file[:webadmin][:files][:stderr_trace] : WEBADMIN_STDERR_TRACE
|
72
|
+
self[:webadmin_port] = (@config_from_file[:webadmin][:port])? @config_from_file[:webadmin][:port] : WEBADMIN_PORT
|
73
|
+
self[:webadmin_ip] = (@config_from_file[:webadmin][:ip])? @config_from_file[:webadmin][:ip] : WEBADMIN_IP
|
74
|
+
self[:webadmin_proxy] = (@config_from_file[:webadmin][:proxy])? @config_from_file[:webadmin][:proxy] : WEBADMIN_PROXY
|
75
|
+
self[:webadmin_process_name] = (@config_from_file[:webadmin][:process_name])? @config_from_file[:webadmin][:process_name] : WEBADMIN_PROCESS_NAME
|
76
|
+
self[:webadmin_pid_file] = (@config_from_file[:webadmin][:files][:pid_file])? @config_from_file[:webadmin][:files][:pid_file] : WEBADMIN_PID_FILE
|
77
|
+
self[:webadmin_stdout_trace] = (@config_from_file[:webadmin][:files][:stdout_trace])? @config_from_file[:webadmin][:files][:stdout_trace] : WEBADMIN_STDOUT_TRACE
|
78
|
+
self[:webadmin_stderr_trace] = (@config_from_file[:webadmin][:files][:stderr_trace])? @config_from_file[:webadmin][:files][:stderr_trace] : WEBADMIN_STDERR_TRACE
|
45
79
|
|
46
80
|
|
47
|
-
self[:pid_path] = (config_from_file[:paths][:pid_path])? config_from_file[:paths][:pid_path] : PID_PATH
|
48
|
-
self[:trace_path] = (config_from_file[:paths][:trace_path])? config_from_file[:paths][:trace_path] : TRACE_PATH
|
81
|
+
self[:pid_path] = (@config_from_file[:paths][:pid_path])? @config_from_file[:paths][:pid_path] : PID_PATH
|
82
|
+
self[:trace_path] = (@config_from_file[:paths][:trace_path])? @config_from_file[:paths][:trace_path] : TRACE_PATH
|
49
83
|
|
50
84
|
|
51
85
|
self[:execution_template_tokens] = EXECUTION_TEMPLATE_TOKENS_LIST
|
52
|
-
self[:execution_template_path] = (config_from_file[:templates][:execution][:path])? config_from_file[:templates][:execution][:path] : EXECUTION_TEMPLATE
|
86
|
+
self[:execution_template_path] = (@config_from_file[:templates][:execution][:path])? @config_from_file[:templates][:execution][:path] : EXECUTION_TEMPLATE
|
87
|
+
|
88
|
+
self[:transports] = {} ; self[:transports].merge! TRANSPORTS_STRUCT ; self[:transports].merge! @config_from_file[:transports] if @config_from_file[:transports]
|
89
|
+
self[:backends] = {} ; self[:backends].merge! BACKENDS_STRUCT ; self[:backends].merge! @config_from_file[:backends] if @config_from_file[:backends]
|
90
|
+
self[:loggers] = {} ; self[:loggers].merge! LOGGERS_STRUCT ; self[:loggers].merge! @config_from_file[:loggers] if @config_from_file[:loggers]
|
91
|
+
|
92
|
+
self[:processes] = (@config_from_file[:processes])? @config_from_file[:processes] : {}
|
93
|
+
self[:logs] = (@config_from_file[:logs])? @config_from_file[:logs] : {}
|
94
|
+
self[:commands] = (@config_from_file[:commands])? @config_from_file[:commands] : {}
|
95
|
+
self[:sequences] = (@config_from_file[:sequences])? @config_from_file[:sequences] : {}
|
96
|
+
self[:transfers] = (@config_from_file[:transfers])? @config_from_file[:transfers] : {}
|
97
|
+
end
|
53
98
|
|
54
|
-
self[:transports] = {} ; self[:transports].merge! TRANSPORTS_STRUCT ; self[:transports].merge! config_from_file[:transports] if config_from_file[:transports]
|
55
|
-
self[:backends] = {} ; self[:backends].merge! BACKENDS_STRUCT ; self[:backends].merge! config_from_file[:backends] if config_from_file[:backends]
|
56
|
-
self[:loggers] = {} ; self[:loggers].merge! LOGGERS_STRUCT ; self[:loggers].merge! config_from_file[:loggers] if config_from_file[:loggers]
|
57
99
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
100
|
+
def add_log(options = {})
|
101
|
+
@config_from_file = readconf @config_file
|
102
|
+
res = ConfigLinter::new.verify(options)
|
103
|
+
if res[:status] == :success then
|
104
|
+
if @config_from_file[:logs].select{|item| item[:label] == options[:record][:label]}.count > 0 then
|
105
|
+
return {:status => :already_exist}
|
106
|
+
else
|
107
|
+
res[:useless].each {|item| options[:record].delete item} if options[:clean]
|
108
|
+
@config_from_file[:logs].push options[:record]
|
109
|
+
writeconf
|
110
|
+
hash_config_to_default
|
111
|
+
return {:status => :success}
|
112
|
+
end
|
113
|
+
else
|
114
|
+
return res
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
63
118
|
|
119
|
+
def delete_log(options = {})
|
120
|
+
@config_from_file = readconf @config_file
|
121
|
+
unless @config_from_file[:logs].select{|item| item[:label] == options[:label]}.count > 0 then
|
122
|
+
return {:status => :not_found}
|
123
|
+
else
|
124
|
+
@config_from_file[:logs].delete_if {|value| options[:label] == value[:label] }
|
125
|
+
writeconf
|
126
|
+
hash_config_to_default
|
127
|
+
return {:status => :success}
|
128
|
+
end
|
64
129
|
end
|
65
130
|
|
131
|
+
|
66
132
|
# @!group accessors on configurations Items
|
67
133
|
|
68
134
|
# getter for full Config Hash
|
@@ -272,6 +338,16 @@ module Splash
|
|
272
338
|
return YAML.load_file(file)[:splash]
|
273
339
|
end
|
274
340
|
|
341
|
+
# write config to file from @config_from_file
|
342
|
+
# @param [String] file default from CONFIG_FILE
|
343
|
+
# @return [Bool] if ok
|
344
|
+
def writeconf(file = CONFIG_FILE)
|
345
|
+
File.open(file,"w") do |f|
|
346
|
+
data = {}
|
347
|
+
data[:splash] = @config_from_file
|
348
|
+
f.write(data.to_yaml)
|
349
|
+
end
|
350
|
+
end
|
275
351
|
|
276
352
|
end
|
277
353
|
|
data/lib/splash/constants.rb
CHANGED
data/lib/splash/exiter.rb
CHANGED
data/lib/splash/helpers.rb
CHANGED
@@ -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,7 +15,7 @@ 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 "
|
18
|
+
log.call "API : commands, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
19
19
|
commands_recordset = get_config.commands[params[:name].to_sym]
|
20
20
|
unless commands_recordset.nil? then
|
21
21
|
obj = splash_return case: :quiet_exit
|
@@ -1,10 +1,61 @@
|
|
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_log :record => YAML::load(request.body.read), :type => :logs, :clean => true
|
31
|
+
case res[:status]
|
32
|
+
when :success
|
33
|
+
addlog = splash_return case: :quiet_exit, :more => "add logs"
|
34
|
+
when :already_exist
|
35
|
+
addlog = splash_return case: :already_exist, :more => "add logs"
|
36
|
+
when :failure
|
37
|
+
addlog = splash_return case: :configuration_error, :more => "add logs"
|
38
|
+
addlog[:data] = res
|
39
|
+
end
|
40
|
+
content_type format
|
41
|
+
format_response(addlog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
WebAdminApp.delete '/api/config/deletelog/:label.?:format?' do
|
46
|
+
log = get_logger
|
47
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
48
|
+
log.call "API : config, verb : DELETE, route : deletelog, format : #{format}"
|
49
|
+
res = get_config.delete_log label: params[:label].to_sym
|
50
|
+
deletelog = {}
|
51
|
+
case res[:status]
|
52
|
+
when :success
|
53
|
+
deletelog = splash_return case: :quiet_exit, :more => "delete logs"
|
54
|
+
when :not_found
|
55
|
+
deletelog = splash_return case: :not_found, :more => "delete logs"
|
56
|
+
else
|
57
|
+
deletelog = splash_return case: :configuration_error, :more => "delete logs"
|
58
|
+
end
|
59
|
+
content_type format
|
60
|
+
format_response(deletelog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
61
|
+
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
|
@@ -5,7 +5,7 @@
|
|
5
5
|
WebAdminApp.get '/api/process/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 : process, 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
|
@@ -16,7 +16,7 @@ WebAdminApp.get '/api/process/list.?:format?' do
|
|
16
16
|
WebAdminApp.get '/api/process/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 "
|
19
|
+
log.call "API : process, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
20
20
|
process_recordset = get_config.processes.select{|item| item[:process] == params[:name] }
|
21
21
|
unless process_recordset.empty? then
|
22
22
|
record = process_recordset.first
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
WebAdminApp.post '/api/process/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 : process, verb : POST, route : analyse, format : #{format}"
|
36
36
|
results = Splash::Processes::ProcessScanner::new
|
37
37
|
results.analyse
|
38
38
|
res = results.output
|
@@ -46,7 +46,7 @@ end
|
|
46
46
|
WebAdminApp.post '/api/process/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 : process, verb : POST, route : monitor, format : #{format}"
|
50
50
|
results = Splash::Processes::ProcessScanner::new
|
51
51
|
results.analyse
|
52
52
|
res = splash_return results.notify
|
@@ -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
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/commands' do
|
2
2
|
get_menu 2
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : commands, verb : GET, controller : /commands"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/commands/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/documentation' do
|
2
2
|
get_menu 6
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : documentation, verb : GET, controller : /documentation"
|
3
5
|
filename = search_file_in_gem("prometheus-splash","README.md")
|
4
6
|
@data = Kramdown::Document.new(File::readlines(filename).join).to_html
|
5
7
|
slim :documentation, :format => :html
|
@@ -1,4 +1,6 @@
|
|
1
1
|
WebAdminApp.get '/' do
|
2
|
+
log = get_logger
|
3
|
+
log.call "WEB : BASE, verb : GET, controller : /"
|
2
4
|
get_menu -1
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/full.yml"
|
4
6
|
@raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
@@ -9,12 +11,15 @@ end
|
|
9
11
|
|
10
12
|
WebAdminApp.get '/home' do
|
11
13
|
get_menu 0
|
14
|
+
log = get_logger
|
15
|
+
log.call "WEB : home, verb : GET, controller : /home"
|
12
16
|
slim :home, :format => :html
|
13
17
|
end
|
14
18
|
|
15
19
|
WebAdminApp.get '/daemon/:action' do
|
16
20
|
content_type :text
|
17
|
-
|
21
|
+
log = get_logger
|
22
|
+
log.call "WEB : daemon, verb : GET, controller : /daemon/:action"
|
18
23
|
case params[:action]
|
19
24
|
when 'start'
|
20
25
|
startdaemon scheduling: true, purge: false
|
@@ -1,5 +1,7 @@
|
|
1
|
-
WebAdminApp.get '/logs' do
|
1
|
+
WebAdminApp.get '/logs/?:status?/?:label?' do
|
2
2
|
get_menu 0
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : logs, verb : GET, controller : /logs/?:status?/?:label?"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/logs/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -7,8 +9,49 @@ WebAdminApp.get '/logs' do
|
|
7
9
|
raw = RestClient::Request.execute(method: 'POST', url: url,timeout: 10)
|
8
10
|
prov = YAML::load(raw)[:data]
|
9
11
|
@result = {}
|
12
|
+
@log_failed = params[:label] if params[:status] == 'failure'
|
13
|
+
@log_saved = params[:label] if params[:status] == 'success'
|
10
14
|
prov.each {|item|
|
11
15
|
@result[item[:label]] = item
|
12
16
|
}
|
13
17
|
slim :logs, :format => :html
|
14
18
|
end
|
19
|
+
|
20
|
+
|
21
|
+
WebAdminApp.get '/add_modify_log/?:label?' do
|
22
|
+
get_menu 0
|
23
|
+
log = get_logger
|
24
|
+
log.call "WEB : logs, verb : POST, controller : /add_modify_log/?:label?"
|
25
|
+
@data = {}
|
26
|
+
if params[:label] then
|
27
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/logs/show/#{params[:label].to_s}.yml"
|
28
|
+
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
29
|
+
res = YAML::load(raw)
|
30
|
+
@data = res[:data] if res[:status] == :success
|
31
|
+
@data[:old_label] = params[:label].to_s
|
32
|
+
end
|
33
|
+
slim :logs_form, :format => :html
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
WebAdminApp.post '/save_log' do
|
38
|
+
get_menu 0
|
39
|
+
log = get_logger
|
40
|
+
log.call "WEB : logs, verb : POST, controller : /save_log/?:label?"
|
41
|
+
data = {}
|
42
|
+
data[:log] = params[:log]
|
43
|
+
data[:pattern] = params[:pattern]
|
44
|
+
data[:label] = params[:label].to_sym
|
45
|
+
if params[:update] then
|
46
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/deletelog/#{params[:old_label]}"
|
47
|
+
raw = RestClient::Request.execute(method: 'DELETE', url: url,timeout: 10)
|
48
|
+
end
|
49
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/addlog.yml"
|
50
|
+
raw = RestClient::Request.execute(method: 'POST', url: url,timeout: 10, payload: data.to_yaml)
|
51
|
+
res = YAML::load(raw)
|
52
|
+
if res[:status] == :success then
|
53
|
+
redirect "/logs/success/#{params[:label].to_s}"
|
54
|
+
else
|
55
|
+
redirect "/logs/failure/#{params[:label].to_s}"
|
56
|
+
end
|
57
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/processes' do
|
2
2
|
get_menu 1
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : processes, verb : GET, controller : /processes"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/process/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -1,14 +1,19 @@
|
|
1
1
|
WebAdminApp.get '/restclient' do
|
2
|
+
log = get_logger
|
3
|
+
log.call "WEB : restclient, verb : GET, controller : /restclient"
|
2
4
|
get_menu 4
|
3
5
|
slim :restclient, :format => :html
|
4
6
|
end
|
5
7
|
|
6
8
|
WebAdminApp.post '/restclient/query' do
|
9
|
+
log = get_logger
|
10
|
+
log.call "WEB : processes, verb : GET, controller : /restclient/query"
|
7
11
|
@method = params[:method]
|
8
12
|
@url = params[:url]
|
13
|
+
@body = params[:body]
|
9
14
|
@notfound = false
|
10
15
|
begin
|
11
|
-
@result = RestClient::Request.execute(method: @method.to_sym, url: @url,timeout: 10)
|
16
|
+
@result = RestClient::Request.execute(method: @method.to_sym, url: @url,timeout: 10, payload: @body)
|
12
17
|
rescue SocketError
|
13
18
|
@result = false
|
14
19
|
rescue RestClient::NotFound => e
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/sequences' do
|
2
2
|
get_menu 3
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : sequences, verb : GET, controller : /sequences"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/sequences/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
Binary file
|
@@ -1,4 +1,4 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Commands configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Commands configured in Splash
|
2
2
|
|
3
3
|
div.uk-width-medium-1-1
|
4
4
|
div.uk-panel.uk-panel-box
|
@@ -30,30 +30,29 @@ javascript:
|
|
30
30
|
div.uk-grid
|
31
31
|
div.uk-width-medium-1-1
|
32
32
|
div.uk-panel.uk-panel-box
|
33
|
-
div.uk-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
div.uk-button-group
|
39
|
-
- if @status == false
|
40
|
-
button.uk-button(id="start" disabled): i.uk-icon-play
|
41
|
-
button.uk-button(id="stop"): i.uk-icon-stop
|
42
|
-
- else
|
43
|
-
button.uk-button(id="start"): i.uk-icon-play
|
44
|
-
button.uk-button(id="stop" disabled): i.uk-icon-stop
|
45
|
-
td
|
46
|
-
b Status :
|
33
|
+
div.uk-grid
|
34
|
+
div.uk-width-1-3.uk-text-large.uk-text-bold.uk-text-success <i class="uk-icon-cogs uk-icon-justify uk-icon-large"></i> Splash Daemon status
|
35
|
+
div.uk-width-1-3
|
36
|
+
b Actions :
|
37
|
+
div.uk-button-group
|
47
38
|
- if @status == false
|
48
|
-
|
39
|
+
button.uk-button(id="start" disabled): i.uk-icon-play
|
40
|
+
button.uk-button(id="stop"): i.uk-icon-stop
|
49
41
|
- else
|
50
|
-
|
42
|
+
button.uk-button(id="start"): i.uk-icon-play
|
43
|
+
button.uk-button(id="stop" disabled): i.uk-icon-stop
|
44
|
+
div.uk-width-1-3
|
45
|
+
b Status :
|
46
|
+
- if @status == false
|
47
|
+
div.uk-badge.uk-badge-success.uk-badge-notifications(id="daemon") ON
|
48
|
+
- else
|
49
|
+
div.uk-badge.uk-badge-danger.uk-badge-notifications(id="daemon") OFF
|
51
50
|
|
52
51
|
|
53
52
|
div.uk-grid
|
54
53
|
div.uk-width-medium-1-2
|
55
54
|
div.uk-panel.uk-panel-box
|
56
|
-
span.uk-text-large.uk-text-bold Global Configuration
|
55
|
+
span.uk-text-large.uk-text-bold.uk-text-success Global Configuration
|
57
56
|
br
|
58
57
|
span.uk-text-bold <i>Logger and display</i> :
|
59
58
|
ul
|
@@ -68,7 +67,7 @@ div.uk-grid
|
|
68
67
|
|
69
68
|
div.uk-width-medium-1-2
|
70
69
|
div.uk-panel.uk-panel-box
|
71
|
-
span.uk-text-large.uk-text-bold Transport and Backend
|
70
|
+
span.uk-text-large.uk-text-bold.uk-text-success Transport and Backend
|
72
71
|
br
|
73
72
|
span.uk-text-bold <i>Backend</i> :
|
74
73
|
ul
|
@@ -94,7 +93,7 @@ div.uk-grid
|
|
94
93
|
div.uk-grid
|
95
94
|
div.uk-width-medium-1-2
|
96
95
|
div.uk-panel.uk-panel-box
|
97
|
-
span.uk-text-large.uk-text-bold Daemon
|
96
|
+
span.uk-text-large.uk-text-bold.uk-text-success Daemon
|
98
97
|
br
|
99
98
|
ul
|
100
99
|
li <b>Logs monitoring scheduling: </b> #{@data[:daemon_logmon_scheduling]}
|
@@ -110,7 +109,7 @@ div.uk-grid
|
|
110
109
|
|
111
110
|
div.uk-width-medium-1-2
|
112
111
|
div.uk-panel.uk-panel-box
|
113
|
-
span.uk-text-large.uk-text-bold Web UI
|
112
|
+
span.uk-text-large.uk-text-bold.uk-text-success Web UI
|
114
113
|
br
|
115
114
|
span.uk-text-bold <i>Webadmin</i> :
|
116
115
|
ul
|
@@ -11,8 +11,7 @@ html lang="fr-fr" dir="ltr"
|
|
11
11
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/uikit.gradient.min.css" integrity="sha512-Vjr6Vz5D/gNvTBfQW581ssADQr1j8fAOU0seE2SxO8UvsCBZBoFQS9Lec3hkmZbpcYnsifkBtdQaHU4x6MylGw==" crossorigin="anonymous"
|
12
12
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/sticky.gradient.css" integrity="sha512-BY0A+4FEGeikNxmo9Q30BZMGRDykKHScJlOSeGq0uq+ylGDJD3zAApnktyKv9tzira1p0ow+B7VqIlRR2CBWoA==" crossorigin="anonymous"
|
13
13
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/accordion.gradient.min.css" integrity="sha512-Cfd5PRktfT5WA1yUJbYkzjEHvT+9KzqPP1Z1OJud3CFUrkoAc6iIWawoMqPFmtvmxxDNV5RAHfe5DCISV+Gd9A==" crossorigin="anonymous"
|
14
|
-
|
15
|
-
|
14
|
+
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/notify.gradient.min.css" integrity="sha512-HOJctZ/0ww0jFHLHNlNODVEwKf1QxiDKyt3TQZRYZl7e7QSi6whfokIvuMJRoUwykB1SXW4eBeK6MecW4TWFFA==" crossorigin="anonymous"
|
16
15
|
|
17
16
|
link rel="stylesheet" href="/css/ultragreen.css"
|
18
17
|
|
@@ -20,6 +19,7 @@ html lang="fr-fr" dir="ltr"
|
|
20
19
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/uikit.min.js" integrity="sha512-KI08ZutCgdasDMwp5rPKd9nF8r+eAy/bZH3Rjova6HfkDv1W7J72sNW+K++KvMp3HL7z0cCykV9vixJACHeCew==" crossorigin="anonymous"
|
21
20
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/sticky.min.js" integrity="sha512-B21PoHN5PsI7sU3cUcNbitUsXp6Zzp81ZDlKJr1xRXwEh3WSftRmgSOgRYxB8h/SlgW+jazkmOXerT33NB7jGA==" crossorigin="anonymous"
|
22
21
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/accordion.min.js" integrity="sha512-7UmYoHJ9tTZiNqlBuUgnr2l82TmZxhiOVXIjiMVP/hPFQJopjEBfVEFPjNdv97OX8K/FIZ4kAXSE+SRTfUkPMg==" crossorigin="anonymous"
|
22
|
+
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/notify.min.js" integrity="sha512-gaUF+WYo5jZ2OjLCBfhz+4NAtt0YHDtcxulSv6/+1xDP9QysfsqljFadHN6sWkLvyXzKtQ7efofABRJfWOVwtw==" crossorigin="anonymous"
|
23
23
|
|
24
24
|
|
25
25
|
body
|
@@ -1,32 +1,79 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
|
2
|
+
|
3
|
+
|
4
|
+
- unless @log_saved.nil?
|
5
|
+
javascript:
|
6
|
+
UIkit.notify("Log record #{@log_saved} saved", {status:'success'});
|
7
|
+
- unless @log_failed.nil?
|
8
|
+
javascript:
|
9
|
+
UIkit.notify("Log record #{@log_saved} not saved", {status:'danger'});
|
10
|
+
|
11
|
+
|
12
|
+
javascript:
|
13
|
+
$(document).on( 'click','input.delete-log',function(){
|
14
|
+
var id = this.id;
|
15
|
+
var url = "/api/config/deletelog/" + id + ".json";
|
16
|
+
UIkit.modal.confirm('Are you sure?', function(){
|
17
|
+
console.debug(url)
|
18
|
+
$.ajax({
|
19
|
+
url: url,
|
20
|
+
type: 'DELETE',
|
21
|
+
success: function( data ) {
|
22
|
+
console.debug(data)
|
23
|
+
if (data['status'] == 'success') {
|
24
|
+
$('table#logrecords tr#' + id).remove();
|
25
|
+
UIkit.notify("Deleting log for " + id + " done", {status:'success'});
|
26
|
+
}
|
27
|
+
else
|
28
|
+
{
|
29
|
+
UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
|
30
|
+
}
|
31
|
+
},
|
32
|
+
error: function(e) {
|
33
|
+
UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
|
34
|
+
}
|
35
|
+
});
|
36
|
+
});
|
37
|
+
});
|
2
38
|
|
3
39
|
div.uk-width-medium-1-1
|
4
40
|
div.uk-panel.uk-panel-box
|
5
41
|
span.uk-text-large.uk-text-bold List of logs monitored
|
6
42
|
br
|
7
|
-
table.uk-table.uk-table-hover.uk-table-striped
|
43
|
+
table#logrecords.uk-table.uk-table-hover.uk-table-striped
|
8
44
|
thead
|
9
45
|
tr
|
10
46
|
th Log record label
|
11
47
|
th Definition
|
12
48
|
th Status
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
49
|
+
th Actions
|
50
|
+
tbody
|
51
|
+
- @data.each do |log|
|
52
|
+
tr id="#{log[:label].to_s}"
|
53
|
+
td <b>Label</b> : #{log[:label]}
|
54
|
+
td
|
55
|
+
ul
|
56
|
+
li <b>File</b> : #{log[:log]}
|
57
|
+
li <b>Pattern</b> : #{log[:pattern]}
|
58
|
+
td
|
59
|
+
- if @result[log[:label]][:status] == :missing
|
60
|
+
div.uk-badge.uk-badge-warning missing
|
61
|
+
- if @result[log[:label]][:status] == :clean
|
62
|
+
div.uk-badge.uk-badge-success success
|
63
|
+
ul
|
64
|
+
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
65
|
+
- if @result[log[:label]][:status] == :matched
|
66
|
+
div.uk-badge.uk-badge-danger matched
|
18
67
|
ul
|
19
|
-
li <b>
|
20
|
-
li <b>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
32
|
-
li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
|
68
|
+
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
69
|
+
li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
|
70
|
+
td
|
71
|
+
input.delete-log.uk-button.uk-button-mini.uk-button-danger id="#{log[:label].to_s}" value="Delete"
|
72
|
+
br
|
73
|
+
input.modify-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="Modify" onclick="location.href='/add_modify_log/#{log[:label].to_s}';"
|
74
|
+
br
|
75
|
+
input.history-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="History" onclick="location.href='/history/#{log[:label].to_s}';"
|
76
|
+
div.uk-align-right
|
77
|
+
form.uk-form.uk-form-horizontal#query action="/add_modify_log" method="GET"
|
78
|
+
div
|
79
|
+
input.add-log.uk-button type="submit" value="Add new log"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
- unless @data.empty?
|
2
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Modify Splash log monitoring : #{@data[:label]}
|
3
|
+
- else
|
4
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Add new Splash log monitoring
|
5
|
+
|
6
|
+
script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js"
|
7
|
+
|
8
|
+
form.uk-form.uk-form-horizontal#query action="/save_log" method="POST"
|
9
|
+
label.uk-form-label for="label" Label
|
10
|
+
<input class="uk-form-width-large" id="label" type="text" placeholder="label" name="label" value="#{@data[:label].to_s}" required>
|
11
|
+
div
|
12
|
+
label.uk-form-label for="pattern" Pattern
|
13
|
+
<input class="uk-form-width-large" id="pattern" type="text" placeholder="pattern" name="pattern" value="#{@data[:pattern]}" required>
|
14
|
+
div
|
15
|
+
label.uk-form-label for="log" Log file
|
16
|
+
<input class="uk-form-width-large" id="log" type="text" placeholder="log" name="log" value="#{@data[:log]}" required>
|
17
|
+
div
|
18
|
+
- unless @data.empty?
|
19
|
+
input type="hidden" name="update" value="true"
|
20
|
+
input type="hidden" name="old_label" value="#{@data[:old_label].to_s}"
|
21
|
+
div.uk-align-right
|
22
|
+
input.uk-button.uk-button-small-primary type="submit" value="Submit"
|
23
|
+
javascript:
|
24
|
+
$("#query").validate();
|
@@ -3,7 +3,7 @@ nav.uk-navbar.uk-navbar-attached(data-uk-sticky)
|
|
3
3
|
ul.uk-navbar-nav.uk-hidden-small
|
4
4
|
- for item in @menu
|
5
5
|
li class=( (item == @current_item)? "uk-active" : "uk-inactive")
|
6
|
-
a href="/#{item.downcase}" title="Access to #{item.capitalize}" <i class="uk-icon-#{@menu_icons[item]}"></i> #{item.capitalize}
|
6
|
+
a.uk-navbar-nav-subtitle href="/#{item.downcase}" title="Access to #{item.capitalize}" <i class="uk-icon-#{@menu_icons[item]}"></i><div> #{item.capitalize}</div>
|
7
7
|
a.uk-navbar-toggle.uk-visible-small(href="#offcanvas" data-uk-offcanvas)
|
8
8
|
div.uk-navbar-brand.uk-navbar-left.uk-visible-small
|
9
9
|
<i class="uk-icon-arrow-left"></i> Menu
|
@@ -1,4 +1,4 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Processes configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Processes configured in Splash
|
2
2
|
|
3
3
|
div.uk-width-medium-1-1
|
4
4
|
div.uk-panel.uk-panel-box
|
@@ -1,7 +1,7 @@
|
|
1
1
|
- if @proxy
|
2
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Proxies for Prometheus components
|
2
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Proxies for Prometheus components
|
3
3
|
- else
|
4
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Links for Prometheus components
|
4
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Links for Prometheus components
|
5
5
|
div.uk-width-medium-1-1
|
6
6
|
div.uk-panel.uk-panel-box
|
7
7
|
ul.uk-list
|
@@ -1,4 +1,4 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> REST Client
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> REST Client
|
2
2
|
|
3
3
|
div.uk-grid
|
4
4
|
div.uk-width-1-1
|
@@ -7,7 +7,7 @@ div.uk-grid
|
|
7
7
|
<i class="uk-icon-question-circle"></i> Request
|
8
8
|
form.uk-form.uk-form-horizontal#query action="/restclient/query" method="POST"
|
9
9
|
label.uk-form-label for="method" Method
|
10
|
-
select
|
10
|
+
select#method name="method"
|
11
11
|
option GET
|
12
12
|
option POST
|
13
13
|
option DELETE
|
@@ -15,8 +15,11 @@ div.uk-grid
|
|
15
15
|
div
|
16
16
|
label.uk-form-label for="url" Endpoint
|
17
17
|
input.uk-form-width-large#url type="text" placeholder="url" name="url"
|
18
|
-
|
19
|
-
|
18
|
+
div
|
19
|
+
label.uk-form-label for="body" Body
|
20
|
+
textarea.uk-form-large cols="50" name="body" rows="5" placeholder="body"
|
21
|
+
div.uk-align-right
|
22
|
+
input.uk-button.uk-button-small-primary type="submit" value="Send"
|
20
23
|
|
21
24
|
div.uk-grid
|
22
25
|
div.uk-width-1-1
|
@@ -1,28 +1,32 @@
|
|
1
|
-
|
1
|
+
div
|
2
2
|
ul.uk-list
|
3
3
|
li <b>HTTP Method</b> : #{@method}
|
4
4
|
li <b>URL</b> : #{@url}
|
5
5
|
h3 Result :
|
6
6
|
- unless @result == false
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
div.uk-grid.uk-text-small
|
8
|
+
div.uk-width-1-2
|
9
|
+
table.uk-table
|
10
|
+
tr
|
11
|
+
td.uk-width-2-10
|
12
|
+
i.uk-icon-file-o
|
13
|
+
| <b>Body :</b>
|
14
|
+
td.uk-width-8-10.uk-scrollable-text <pre><code>#{@result}</code></pre>
|
15
|
+
div.uk-width-1-2
|
16
|
+
table.uk-table
|
17
|
+
tr
|
18
|
+
td.uk-width-2-10
|
19
|
+
i.uk-icon-dollar
|
20
|
+
| <b>Return code :</b>
|
21
|
+
td.uk-width-8-10 #{@result.code}
|
22
|
+
tr
|
23
|
+
td.uk-width-2-10
|
24
|
+
i.uk-icon-header
|
25
|
+
| <b>Headers :</b>
|
26
|
+
td.uk-width-8-10
|
27
|
+
ul
|
28
|
+
- @result.headers.each do |hkey,value|
|
29
|
+
li <i><b>#{hkey}:</b> #{value}</i>
|
26
30
|
|
27
31
|
- else
|
28
32
|
div.uk-alert.uk-alert-danger
|
@@ -1,4 +1,4 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Sequences configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Sequences configured in Splash
|
2
2
|
|
3
3
|
div.uk-width-medium-1-1
|
4
4
|
div.uk-panel.uk-panel-box
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-splash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -456,6 +456,7 @@ files:
|
|
456
456
|
- lib/splash/webadmin/portal/controllers/sequences.rb
|
457
457
|
- lib/splash/webadmin/portal/init.rb
|
458
458
|
- lib/splash/webadmin/portal/public/css/ultragreen.css
|
459
|
+
- lib/splash/webadmin/portal/public/favicon.ico
|
459
460
|
- lib/splash/webadmin/portal/public/fonts/FontAwesome.otf
|
460
461
|
- lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.ttf
|
461
462
|
- lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff
|
@@ -468,6 +469,7 @@ files:
|
|
468
469
|
- lib/splash/webadmin/portal/views/home.slim
|
469
470
|
- lib/splash/webadmin/portal/views/layout.slim
|
470
471
|
- lib/splash/webadmin/portal/views/logs.slim
|
472
|
+
- lib/splash/webadmin/portal/views/logs_form.slim
|
471
473
|
- lib/splash/webadmin/portal/views/nav.slim
|
472
474
|
- lib/splash/webadmin/portal/views/not_found.slim
|
473
475
|
- lib/splash/webadmin/portal/views/processes.slim
|
@@ -508,7 +510,7 @@ homepage: https://github.com/Ultragreen/prometheus-splash
|
|
508
510
|
licenses:
|
509
511
|
- BSD-2-Clause
|
510
512
|
metadata: {}
|
511
|
-
post_install_message:
|
513
|
+
post_install_message:
|
512
514
|
rdoc_options: []
|
513
515
|
require_paths:
|
514
516
|
- lib
|
@@ -523,8 +525,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
523
525
|
- !ruby/object:Gem::Version
|
524
526
|
version: '0'
|
525
527
|
requirements: []
|
526
|
-
rubygems_version: 3.
|
527
|
-
signing_key:
|
528
|
+
rubygems_version: 3.1.2
|
529
|
+
signing_key:
|
528
530
|
specification_version: 4
|
529
531
|
summary: Supervision with Prometheus of Logs and Asynchronous tasks orchestration
|
530
532
|
for Services or Hosts
|