prometheus-splash 0.5.3 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -1
- data/README.md +58 -60
- data/bin/splash +3 -0
- data/config/splash.yml +110 -11
- data/lib/splash/backends.rb +7 -0
- data/lib/splash/backends/file.rb +36 -0
- data/lib/splash/backends/redis.rb +44 -1
- data/lib/splash/cli.rb +11 -4
- data/lib/splash/cli/commands.rb +136 -9
- data/lib/splash/cli/config.rb +9 -1
- data/lib/splash/cli/daemon.rb +49 -2
- data/lib/splash/cli/documentation.rb +5 -2
- data/lib/splash/cli/logs.rb +116 -47
- data/lib/splash/cli/process.rb +121 -52
- data/lib/splash/cli/sequences.rb +114 -0
- data/lib/splash/cli/transfers.rb +213 -0
- data/lib/splash/cli/webadmin.rb +46 -0
- data/lib/splash/commands.rb +111 -23
- data/lib/splash/config.rb +174 -23
- data/lib/splash/config/flush.rb +9 -1
- data/lib/splash/config/sanitycheck.rb +7 -2
- data/lib/splash/config/service.rb +8 -1
- data/lib/splash/config/setup.rb +8 -3
- data/lib/splash/constants.rb +37 -8
- data/lib/splash/daemon.rb +5 -1
- data/lib/splash/daemon/controller.rb +31 -11
- data/lib/splash/daemon/metrics.rb +29 -14
- data/lib/splash/daemon/orchestrator.rb +114 -35
- data/lib/splash/daemon/orchestrator/grammar.rb +40 -5
- data/lib/splash/daemon/orchestrator/hooks.rb +10 -0
- data/lib/splash/dependencies.rb +18 -1
- data/lib/splash/exiter.rb +14 -0
- data/lib/splash/helpers.rb +88 -46
- data/lib/splash/loggers.rb +30 -4
- data/lib/splash/loggers/cli.rb +18 -11
- data/lib/splash/loggers/daemon.rb +14 -3
- data/lib/splash/loggers/dual.rb +14 -1
- data/lib/splash/loggers/web.rb +51 -0
- data/lib/splash/logs.rb +105 -20
- data/lib/splash/processes.rb +104 -21
- data/lib/splash/sequences.rb +105 -0
- data/lib/splash/templates.rb +10 -0
- data/lib/splash/transfers.rb +229 -0
- data/lib/splash/transports.rb +9 -0
- data/lib/splash/transports/rabbitmq.rb +33 -4
- data/lib/splash/webadmin.rb +122 -0
- data/lib/splash/webadmin/api/routes/commands.rb +28 -0
- data/lib/splash/webadmin/api/routes/config.rb +10 -0
- data/lib/splash/webadmin/api/routes/init.rb +2 -0
- data/lib/splash/webadmin/api/routes/logs.rb +59 -0
- data/lib/splash/webadmin/api/routes/process.rb +60 -0
- data/lib/splash/webadmin/api/routes/sequences.rb +28 -0
- data/lib/splash/webadmin/main.rb +27 -0
- data/lib/splash/webadmin/portal/controllers/commands.rb +7 -0
- data/lib/splash/webadmin/portal/controllers/documentation.rb +6 -0
- data/lib/splash/webadmin/portal/controllers/home.rb +31 -0
- data/lib/splash/webadmin/portal/controllers/logs.rb +14 -0
- data/lib/splash/webadmin/portal/controllers/notfound.rb +5 -0
- data/lib/splash/webadmin/portal/controllers/processes.rb +14 -0
- data/lib/splash/webadmin/portal/controllers/proxy.rb +36 -0
- data/lib/splash/webadmin/portal/controllers/restclient.rb +19 -0
- data/lib/splash/webadmin/portal/controllers/sequences.rb +7 -0
- data/lib/splash/webadmin/portal/init.rb +11 -0
- data/lib/splash/webadmin/portal/public/css/ultragreen.css +8544 -0
- data/lib/splash/webadmin/portal/public/fonts/FontAwesome.otf +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff +0 -0
- data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff2 +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash.png +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash_reduce.png +0 -0
- data/lib/splash/webadmin/portal/public/images/logo_splash_tiny.png +0 -0
- data/lib/splash/webadmin/portal/views/commands.slim +49 -0
- data/lib/splash/webadmin/portal/views/documentation.slim +3 -0
- data/lib/splash/webadmin/portal/views/home.slim +123 -0
- data/lib/splash/webadmin/portal/views/layout.slim +43 -0
- data/lib/splash/webadmin/portal/views/logs.slim +32 -0
- data/lib/splash/webadmin/portal/views/nav.slim +17 -0
- data/lib/splash/webadmin/portal/views/not_found.slim +3 -0
- data/lib/splash/webadmin/portal/views/processes.slim +29 -0
- data/lib/splash/webadmin/portal/views/proxy.slim +16 -0
- data/lib/splash/webadmin/portal/views/restclient.slim +41 -0
- data/lib/splash/webadmin/portal/views/restclient_result.slim +29 -0
- data/lib/splash/webadmin/portal/views/sequences.slim +50 -0
- data/prometheus-splash.gemspec +11 -2
- data/spec/helpers_spec.rb +119 -0
- metadata +191 -5
data/lib/splash/config.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Dir[File.dirname(__FILE__) + '/config/*.rb'].each {|file| require file }
|
3
3
|
|
4
|
+
# base Splash Module
|
4
5
|
module Splash
|
6
|
+
|
7
|
+
# Config namespace
|
5
8
|
module Config
|
6
9
|
include Splash::Helpers
|
7
10
|
include Splash::Constants
|
@@ -12,24 +15,41 @@ module Splash
|
|
12
15
|
class Configuration < Hash
|
13
16
|
include Splash::Constants
|
14
17
|
|
18
|
+
# constructor : read config file and map against Constants
|
15
19
|
def initialize(config_file=CONFIG_FILE)
|
16
20
|
config_from_file = readconf config_file
|
17
21
|
self[:version] = VERSION
|
18
22
|
self[:author] = "#{AUTHOR} <#{EMAIL}>"
|
19
23
|
self[:copyright] = "#{COPYRIGHT} #{LICENSE}"
|
20
|
-
|
21
|
-
self[:
|
24
|
+
|
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
|
28
|
+
|
22
29
|
self[:daemon_process_name] = (config_from_file[:daemon][:process_name])? config_from_file[:daemon][:process_name] : DAEMON_PROCESS_NAME
|
23
30
|
self[:daemon_logmon_scheduling] = (config_from_file[:daemon][:logmon_scheduling])? config_from_file[:daemon][:logmon_scheduling] : DAEMON_LOGMON_SCHEDULING
|
24
31
|
self[:daemon_metrics_scheduling] = (config_from_file[:daemon][:metrics_scheduling])? config_from_file[:daemon][:metrics_scheduling] : DAEMON_METRICS_SCHEDULING
|
25
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
|
36
|
+
|
37
|
+
|
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
|
45
|
+
|
46
|
+
|
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
|
49
|
+
|
50
|
+
|
26
51
|
self[:execution_template_tokens] = EXECUTION_TEMPLATE_TOKENS_LIST
|
27
52
|
self[:execution_template_path] = (config_from_file[:templates][:execution][:path])? config_from_file[:templates][:execution][:path] : EXECUTION_TEMPLATE
|
28
|
-
self[:pid_path] = (config_from_file[:daemon][:paths][:pid_path])? config_from_file[:daemon][:paths][:pid_path] : DAEMON_PID_PATH
|
29
|
-
self[:trace_path] = (config_from_file[:daemon][:paths][:trace_path])? config_from_file[:daemon][:paths][:trace_path] : TRACE_PATH
|
30
|
-
self[:pid_file] = (config_from_file[:daemon][:files][:pid_file])? config_from_file[:daemon][:files][:pid_file] : DAEMON_PID_FILE
|
31
|
-
self[:stdout_trace] = (config_from_file[:daemon][:files][:stdout_trace])? config_from_file[:daemon][:files][:stdout_trace] : DAEMON_STDOUT_TRACE
|
32
|
-
self[:stderr_trace] = (config_from_file[:daemon][:files][:stderr_trace])? config_from_file[:daemon][:files][:stderr_trace] : DAEMON_STDERR_TRACE
|
33
53
|
|
34
54
|
self[:transports] = {} ; self[:transports].merge! TRANSPORTS_STRUCT ; self[:transports].merge! config_from_file[:transports] if config_from_file[:transports]
|
35
55
|
self[:backends] = {} ; self[:backends].merge! BACKENDS_STRUCT ; self[:backends].merge! config_from_file[:backends] if config_from_file[:backends]
|
@@ -38,91 +58,216 @@ module Splash
|
|
38
58
|
self[:processes] = (config_from_file[:processes])? config_from_file[:processes] : {}
|
39
59
|
self[:logs] = (config_from_file[:logs])? config_from_file[:logs] : {}
|
40
60
|
self[:commands] = (config_from_file[:commands])? config_from_file[:commands] : {}
|
61
|
+
self[:sequences] = (config_from_file[:sequences])? config_from_file[:sequences] : {}
|
62
|
+
self[:transfers] = (config_from_file[:transfers])? config_from_file[:transfers] : {}
|
41
63
|
|
42
64
|
end
|
43
65
|
|
44
66
|
# @!group accessors on configurations Items
|
45
67
|
|
68
|
+
# getter for full Config Hash
|
69
|
+
# @return [Hash]
|
70
|
+
def full
|
71
|
+
return self
|
72
|
+
end
|
73
|
+
|
74
|
+
# getter for loggers Hash Config sample
|
75
|
+
# @return [Hash]
|
46
76
|
def loggers
|
47
77
|
return self[:loggers]
|
48
78
|
end
|
49
79
|
|
80
|
+
# getter for backends Hash Config sample
|
81
|
+
# @return [Hash]
|
50
82
|
def backends
|
51
83
|
return self[:backends]
|
52
84
|
end
|
53
85
|
|
86
|
+
# getter for transports Hash Config sample
|
87
|
+
# @return [Hash]
|
54
88
|
def transports
|
55
89
|
return self[:transports]
|
56
90
|
end
|
57
91
|
|
92
|
+
# getter for transfers Hash Config sample
|
93
|
+
# @return [Hash]
|
94
|
+
def transfers
|
95
|
+
return self[:transfers]
|
96
|
+
end
|
97
|
+
|
98
|
+
# getter for daemon_logmon_scheduling Hash Config sample
|
99
|
+
# @return [Hash]
|
58
100
|
def daemon_logmon_scheduling
|
59
101
|
return self[:daemon_logmon_scheduling]
|
60
102
|
end
|
61
103
|
|
104
|
+
# getter for daemon_procmon_scheduling Hash Config sample
|
105
|
+
# @return [Hash]
|
62
106
|
def daemon_procmon_scheduling
|
63
107
|
return self[:daemon_procmon_scheduling]
|
64
108
|
end
|
65
109
|
|
110
|
+
# getter for daemon_metrics_scheduling Hash Config sample
|
111
|
+
# @return [Hash]
|
66
112
|
def daemon_metrics_scheduling
|
67
113
|
return self[:daemon_metrics_scheduling]
|
68
114
|
end
|
69
115
|
|
116
|
+
# getter for daemon_process_name Config sample
|
117
|
+
# @return [String]
|
118
|
+
def daemon_process_name
|
119
|
+
return self[:daemon_process_name]
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
# getter for daemon_full_pid_path Config sample
|
124
|
+
# @return [String]
|
125
|
+
def daemon_full_pid_path
|
126
|
+
return "#{self[:pid_path]}/#{self[:daemon_pid_file]}"
|
127
|
+
end
|
128
|
+
|
129
|
+
# getter for daemon_full_stdout_trace_path Config sample
|
130
|
+
# @return [String]
|
131
|
+
def daemon_full_stdout_trace_path
|
132
|
+
return "#{self[:trace_path]}/#{self[:daemon_stdout_trace]}"
|
133
|
+
end
|
134
|
+
|
135
|
+
# getter for daemon_full_stderr_trace_path Config sample
|
136
|
+
# @return [String]
|
137
|
+
def daemon_full_stderr_trace_path
|
138
|
+
return "#{self[:trace_path]}/#{self[:daemon_stderr_trace]}"
|
139
|
+
end
|
140
|
+
|
141
|
+
# getter for execution_template_path Hash Config sample
|
142
|
+
# @return [String]
|
70
143
|
def execution_template_path
|
71
144
|
return self[:execution_template_path]
|
72
145
|
end
|
146
|
+
|
147
|
+
# getter for execution_template_tokens Hash Config sample
|
148
|
+
# @return [Array]
|
73
149
|
def execution_template_tokens
|
74
150
|
return self[:execution_template_tokens]
|
75
151
|
end
|
152
|
+
|
153
|
+
|
154
|
+
# getter for webadmin_port Hash Config sample
|
155
|
+
# @return [Fixnum]
|
156
|
+
def webadmin_port
|
157
|
+
return self[:webadmin_port]
|
158
|
+
end
|
159
|
+
|
160
|
+
# getter for webadmin_ip Hash Config sample
|
161
|
+
# @return [String]
|
162
|
+
def webadmin_ip
|
163
|
+
return self[:webadmin_ip]
|
164
|
+
end
|
165
|
+
|
166
|
+
# getter for webadmin_proxy Hash Config sample
|
167
|
+
# @return [TrueClass|FalseClass]
|
168
|
+
def webadmin_proxy
|
169
|
+
return self[:webadmin_proxy]
|
170
|
+
end
|
171
|
+
|
172
|
+
# getter for webadmin_process_name Config sample
|
173
|
+
# @return [String]
|
174
|
+
def webadmin_process_name
|
175
|
+
return self[:webadmin_process_name]
|
176
|
+
end
|
177
|
+
|
178
|
+
# getter for webadmin_full_pid_path Config sample
|
179
|
+
# @return [String]
|
180
|
+
def webadmin_full_pid_path
|
181
|
+
return "#{self[:pid_path]}/#{self[:webadmin_pid_file]}"
|
182
|
+
end
|
183
|
+
|
184
|
+
# getter for webadmin_full_stdout_trace_path Config sample
|
185
|
+
# @return [String]
|
186
|
+
def webadmin_full_stdout_trace_path
|
187
|
+
return "#{self[:trace_path]}/#{self[:webadmin_stdout_trace]}"
|
188
|
+
end
|
189
|
+
|
190
|
+
# getter for webadmin_full_stderr_trace_path Config sample
|
191
|
+
# @return [String]
|
192
|
+
def webadmin_full_stderr_trace_path
|
193
|
+
return "#{self[:trace_path]}/#{self[:webadmin_stderr_trace]}"
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
# getter for logs Hash Config sample
|
200
|
+
# @return [Hash]
|
76
201
|
def logs
|
77
202
|
return self[:logs]
|
78
203
|
end
|
79
204
|
|
205
|
+
# getter for commands Hash Config sample
|
206
|
+
# @return [Hash]
|
80
207
|
def commands
|
81
208
|
return self[:commands]
|
82
209
|
end
|
83
210
|
|
211
|
+
# getter for processes Hash Config sample
|
212
|
+
# @return [Hash]
|
84
213
|
def processes
|
85
214
|
return self[:processes]
|
86
215
|
end
|
87
216
|
|
217
|
+
# getter for sequences Hash Config sample
|
218
|
+
# @return [Hash]
|
219
|
+
def sequences
|
220
|
+
return self[:sequences]
|
221
|
+
end
|
222
|
+
|
223
|
+
# getter for author Config sample
|
224
|
+
# @return [String]
|
88
225
|
def author
|
89
226
|
return self[:author]
|
90
227
|
end
|
91
228
|
|
229
|
+
# getter for copyright Config sample
|
230
|
+
# @return [String]
|
92
231
|
def copyright
|
93
232
|
return self[:copyright]
|
94
233
|
end
|
95
234
|
|
235
|
+
# getter for version Config sample
|
236
|
+
# @return [String]
|
96
237
|
def version
|
97
238
|
return self[:version]
|
98
239
|
end
|
99
240
|
|
100
|
-
def daemon_process_name
|
101
|
-
return self[:daemon_process_name]
|
102
|
-
end
|
103
241
|
|
104
|
-
def prometheus_pushgateway_host
|
105
|
-
return self[:prometheus_pushgateway_host]
|
106
|
-
end
|
107
|
-
def prometheus_pushgateway_port
|
108
|
-
return self[:prometheus_pushgateway_port]
|
109
|
-
end
|
110
242
|
|
111
|
-
|
112
|
-
|
243
|
+
|
244
|
+
|
245
|
+
# getter for prometheus_pushgateway_url Config sample
|
246
|
+
# @return [String]
|
247
|
+
def prometheus_pushgateway_url
|
248
|
+
return self[:prometheus_pushgateway_url]
|
113
249
|
end
|
114
250
|
|
115
|
-
|
116
|
-
|
251
|
+
# getter for prometheus_alertmanager_url Config sample
|
252
|
+
# @return [String]
|
253
|
+
def prometheus_alertmanager_url
|
254
|
+
return self[:prometheus_alertmanager_url]
|
117
255
|
end
|
118
256
|
|
119
|
-
|
120
|
-
|
257
|
+
|
258
|
+
# getter for prometheus_url Config sample
|
259
|
+
# @return [String]
|
260
|
+
def prometheus_url
|
261
|
+
return self[:prometheus_url]
|
121
262
|
end
|
122
263
|
|
123
264
|
# @!endgroup
|
124
265
|
|
125
266
|
private
|
267
|
+
|
268
|
+
# read config file
|
269
|
+
# @param [String] file default from CONFIG_FILE
|
270
|
+
# @return [Hash] The config global Hash from YAML
|
126
271
|
def readconf(file = CONFIG_FILE)
|
127
272
|
return YAML.load_file(file)[:splash]
|
128
273
|
end
|
@@ -133,6 +278,7 @@ module Splash
|
|
133
278
|
|
134
279
|
|
135
280
|
@@config=nil
|
281
|
+
|
136
282
|
# factory of Configuration Class instance
|
137
283
|
# @param [String] config_file the path of the YAML Config file
|
138
284
|
# @return [SPlash::Config::Configuration]
|
@@ -140,7 +286,12 @@ module Splash
|
|
140
286
|
return @@config ||= Configuration::new(config_file)
|
141
287
|
end
|
142
288
|
|
143
|
-
|
289
|
+
# reset of Configuration Class instance
|
290
|
+
# @param [String] config_file the path of the YAML Config file
|
291
|
+
# @return [SPlash::Config::Configuration]
|
292
|
+
def rehash_config(config_file=CONFIG_FILE)
|
293
|
+
return @@config = Configuration::new(config_file)
|
294
|
+
end
|
144
295
|
|
145
296
|
|
146
297
|
end
|
data/lib/splash/config/flush.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# Base Splash module
|
1
4
|
module Splash
|
5
|
+
|
6
|
+
# module for Configuration utilities
|
2
7
|
module ConfigUtilities
|
3
8
|
include Splash::Constants
|
4
9
|
|
5
|
-
|
10
|
+
# clean backend action method
|
11
|
+
# @param [Hash] options
|
12
|
+
# @option options [Symbol] :name the name of the backend (:redis, :file)
|
13
|
+
# @return [Hash] An Exiter case hash (:quiet_exit or :configuration_error)
|
6
14
|
def flush_backend(options ={})
|
7
15
|
config = get_config
|
8
16
|
self.extend Splash::Backends
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# Base Splash module
|
2
4
|
module Splash
|
5
|
+
|
6
|
+
# moudle for Configuration utilities
|
3
7
|
module ConfigUtilities
|
4
8
|
include Splash::Constants
|
5
9
|
|
6
10
|
|
7
11
|
|
8
12
|
# Sanitycheck action method for testing installation of Splash
|
9
|
-
# @
|
13
|
+
# @param [Hash] options
|
14
|
+
# @return [Hash] An Exiter case hash (:splash_sanitycheck_success or :splash_sanitycheck_error)
|
10
15
|
def checkconfig(options ={})
|
11
16
|
self.extend Splash::Loggers
|
12
17
|
log = get_logger
|
@@ -45,7 +50,7 @@ module Splash
|
|
45
50
|
end
|
46
51
|
|
47
52
|
target = "Prometheus PushGateway Service running"
|
48
|
-
if verify_service
|
53
|
+
if verify_service url: config.prometheus_pushgateway_url then
|
49
54
|
log.ok target
|
50
55
|
else
|
51
56
|
log.ko target
|
@@ -1,11 +1,18 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# Base Splash module
|
4
4
|
module Splash
|
5
|
+
|
6
|
+
# moudle for Configuration utilities
|
5
7
|
module ConfigUtilities
|
6
8
|
include Splash::Constants
|
7
9
|
include Splash::Helpers
|
8
10
|
|
11
|
+
|
12
|
+
# clean backend configured
|
13
|
+
# @param [Hash] options
|
14
|
+
# @option options [Symbol] :name the name of the backend (:redis, :file)
|
15
|
+
# @return [Hash] An Exiter case hash (:quiet_exit or :configuration_error)
|
9
16
|
def addservice(options = {})
|
10
17
|
local_service_file = search_file_in_gem "prometheus-splash", "templates/splashd.service"
|
11
18
|
config = get_config
|
data/lib/splash/config/setup.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
|
2
1
|
# coding: utf-8
|
3
2
|
|
4
|
-
|
3
|
+
# Base Splash module
|
5
4
|
module Splash
|
5
|
+
|
6
|
+
# moudle for Configuration utilities
|
6
7
|
module ConfigUtilities
|
7
8
|
include Splash::Constants
|
8
9
|
include Splash::Helpers
|
10
|
+
|
11
|
+
|
9
12
|
# Setup action method for installing Splash
|
10
|
-
# @
|
13
|
+
# @param [Hash] options
|
14
|
+
# @option options [Symbol] :preserve flag to preserve config file during setup
|
15
|
+
# @return [Hash] An Exiter case hash (:splash_setup_success or :splash_setup_error)
|
11
16
|
def setupsplash(options = {})
|
12
17
|
conf_in_path = search_file_in_gem "prometheus-splash", "config/splash.yml"
|
13
18
|
full_res = 0
|
data/lib/splash/constants.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
3
|
+
# base Splash module / namespace
|
2
4
|
module Splash
|
5
|
+
|
6
|
+
# Constants namespace
|
3
7
|
module Constants
|
4
|
-
|
8
|
+
|
9
|
+
# Current splash version
|
10
|
+
VERSION = "0.8.1"
|
5
11
|
|
6
12
|
# the path to th config file, not overridable by config
|
7
13
|
CONFIG_FILE = "/etc/splash.yml"
|
8
14
|
# the default execution trace_path if backend file
|
9
15
|
TRACE_PATH="/var/run/splash"
|
16
|
+
# the default pid file path
|
17
|
+
PID_PATH="/var/run"
|
10
18
|
|
11
19
|
|
12
20
|
# default scheduling criteria for log monitoring
|
@@ -18,8 +26,6 @@ module Splash
|
|
18
26
|
|
19
27
|
# the display name of daemon in proc info (ps/top)
|
20
28
|
DAEMON_PROCESS_NAME="Splash : daemon."
|
21
|
-
# the default pid file path
|
22
|
-
DAEMON_PID_PATH="/var/run"
|
23
29
|
# the default pid file name
|
24
30
|
DAEMON_PID_FILE="splash.pid"
|
25
31
|
# the default sdtout trace file
|
@@ -36,10 +42,14 @@ module Splash
|
|
36
42
|
# type of licence
|
37
43
|
LICENSE="BSD-2-Clause"
|
38
44
|
|
39
|
-
# the default prometheus pushgateway
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
# the default prometheus pushgateway URL
|
46
|
+
PROMETHEUS_PUSHGATEWAY_URL = 'http://localhost:9091/'
|
47
|
+
|
48
|
+
# the default prometheus Alertmanager URL
|
49
|
+
PROMETHEUS_ALERTMANAGER_URL = 'http://localhost:9092/'
|
50
|
+
|
51
|
+
# the default prometheus URL
|
52
|
+
PROMETHEUS_URL = "http://localhost:9090/"
|
43
53
|
|
44
54
|
# the default path fo execution report template
|
45
55
|
EXECUTION_TEMPLATE="/etc/splash_execution_report.tpl"
|
@@ -55,11 +65,30 @@ module Splash
|
|
55
65
|
:active => :rabbitmq,
|
56
66
|
:rabbitmq => { :port => 5672, :host => "localhost", :vhost => '/'} }
|
57
67
|
|
58
|
-
|
68
|
+
# loggers default settings
|
69
|
+
LOGGERS_STRUCT = { :list => [:cli,:daemon, :dual, :web],
|
59
70
|
:default => :cli,
|
60
71
|
:level => :info,
|
61
72
|
:daemon => {:file => '/var/log/splash.log'},
|
73
|
+
:web => {:file => '/var/log/splash_web.log'},
|
62
74
|
:cli => {:color => true, :emoji => true } }
|
63
75
|
|
76
|
+
WEBADMIN_IP = "127.0.0.1"
|
77
|
+
WEBADMIN_PORT = "9234"
|
78
|
+
WEBADMIN_PROXY = false
|
79
|
+
# the display name of daemon in proc info (ps/top)
|
80
|
+
WEBADMIN_PROCESS_NAME="Splash : WebAdmin."
|
81
|
+
# the default pid file path
|
82
|
+
WEBADMIN_PID_PATH="/var/run"
|
83
|
+
# the default pid file name
|
84
|
+
WEBADMIN_PID_FILE="splash.pid"
|
85
|
+
# the default sdtout trace file
|
86
|
+
WEBADMIN_STDOUT_TRACE="stdout.txt"
|
87
|
+
# the default sdterr trace file
|
88
|
+
WEBADMIN_STDERR_TRACE="stderr.txt"
|
89
|
+
|
90
|
+
# default retention for trace
|
91
|
+
DEFAULT_RETENTION=1
|
92
|
+
|
64
93
|
end
|
65
94
|
end
|