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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -3
  3. data/README.md +400 -178
  4. data/config/splash.yml +28 -14
  5. data/lib/splash/backends.rb +7 -1
  6. data/lib/splash/backends/file.rb +1 -1
  7. data/lib/splash/cli/commands.rb +122 -37
  8. data/lib/splash/cli/config.rb +12 -1
  9. data/lib/splash/cli/daemon.rb +1 -1
  10. data/lib/splash/cli/logs.rb +144 -48
  11. data/lib/splash/cli/process.rb +145 -52
  12. data/lib/splash/cli/transfers.rb +10 -3
  13. data/lib/splash/commands.rb +115 -40
  14. data/lib/splash/config.rb +112 -29
  15. data/lib/splash/config/flush.rb +2 -2
  16. data/lib/splash/constants.rb +3 -4
  17. data/lib/splash/daemon/orchestrator.rb +6 -7
  18. data/lib/splash/daemon/orchestrator/grammar.rb +1 -1
  19. data/lib/splash/dependencies.rb +1 -0
  20. data/lib/splash/exiter.rb +1 -1
  21. data/lib/splash/helpers.rb +1 -1
  22. data/lib/splash/logs.rb +94 -16
  23. data/lib/splash/monkeys.rb +5 -0
  24. data/lib/splash/processes.rb +91 -16
  25. data/lib/splash/sequences.rb +6 -1
  26. data/lib/splash/transfers.rb +13 -8
  27. data/lib/splash/webadmin/api/routes/commands.rb +15 -3
  28. data/lib/splash/webadmin/api/routes/config.rb +140 -2
  29. data/lib/splash/webadmin/api/routes/logs.rb +32 -17
  30. data/lib/splash/webadmin/api/routes/process.rb +21 -9
  31. data/lib/splash/webadmin/api/routes/sequences.rb +2 -2
  32. data/lib/splash/webadmin/main.rb +15 -1
  33. data/lib/splash/webadmin/portal/controllers/commands.rb +101 -1
  34. data/lib/splash/webadmin/portal/controllers/documentation.rb +2 -0
  35. data/lib/splash/webadmin/portal/controllers/home.rb +6 -1
  36. data/lib/splash/webadmin/portal/controllers/logs.rb +71 -1
  37. data/lib/splash/webadmin/portal/controllers/processes.rb +75 -3
  38. data/lib/splash/webadmin/portal/controllers/proxy.rb +2 -1
  39. data/lib/splash/webadmin/portal/controllers/restclient.rb +6 -1
  40. data/lib/splash/webadmin/portal/controllers/sequences.rb +2 -0
  41. data/lib/splash/webadmin/portal/public/css/ultragreen.css +6 -0
  42. data/lib/splash/webadmin/portal/public/favicon.ico +0 -0
  43. data/lib/splash/webadmin/portal/views/command_form.slim +45 -0
  44. data/lib/splash/webadmin/portal/views/command_history.slim +27 -0
  45. data/lib/splash/webadmin/portal/views/commands.slim +70 -20
  46. data/lib/splash/webadmin/portal/views/documentation.slim +1 -1
  47. data/lib/splash/webadmin/portal/views/home.slim +19 -20
  48. data/lib/splash/webadmin/portal/views/layout.slim +2 -2
  49. data/lib/splash/webadmin/portal/views/log_form.slim +27 -0
  50. data/lib/splash/webadmin/portal/views/log_history.slim +24 -0
  51. data/lib/splash/webadmin/portal/views/logs.slim +95 -21
  52. data/lib/splash/webadmin/portal/views/nav.slim +1 -1
  53. data/lib/splash/webadmin/portal/views/not_found.slim +1 -1
  54. data/lib/splash/webadmin/portal/views/process_form.slim +24 -0
  55. data/lib/splash/webadmin/portal/views/process_history.slim +24 -0
  56. data/lib/splash/webadmin/portal/views/processes.slim +80 -7
  57. data/lib/splash/webadmin/portal/views/proxy.slim +2 -2
  58. data/lib/splash/webadmin/portal/views/restclient.slim +7 -4
  59. data/lib/splash/webadmin/portal/views/restclient_result.slim +24 -20
  60. data/lib/splash/webadmin/portal/views/sequences.slim +1 -1
  61. data/prometheus-splash.gemspec +4 -4
  62. data/ultragreen_roodi_coding_convention.yml +4 -4
  63. metadata +18 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db8cc49d7a0a733b08a9f744a2ac14b5196b69fc229fcd77c9c635dd9e6c61e8
4
- data.tar.gz: c839f4d20b88880a458e92de5b2d10f7d58788645fb7b03c0c8e63d403f5ec78
3
+ metadata.gz: d55ef029657bc02603c1c3723df64d3a296bf3956d55ba4a9309402ce468aedc
4
+ data.tar.gz: ba6cb4911ea6b5c4f6f2d8d5f4cb083f37111a768ce2978cadb5b701fdb4e186
5
5
  SHA512:
6
- metadata.gz: 6d1314705d22d1da16a62b265c0a9967b3fa2cd049db1dd25af3631b144b7872da48a84d1c62d36cc9fa650cb398ab4beaba9523d46f79bde52f3b6382b586e3
7
- data.tar.gz: d8d637a2ea309860d988952f87c63b906c1b4c350dfa5327f12f84ddc0cd352c3ca4b7112ac2f180b890d2acc3553db2caaa0abda3fc1a77a0eccf88d6c44f85
6
+ metadata.gz: f85b863c72f11a4fe2716258c647ce28e2691462a1bf74bb84c8c5fa1cd17e8ec0edd0ac4cd0e816b61fc2d4f9ef536b492aaac6658c8e1567e4f6409d959df3
7
+ data.tar.gz: 45b4f6c99ae525033585a059d34e6c1f363f2f2ffdf4637b41aa2ec19ca5f042c436ee9c439fecc99ad937e73e32c7a430f4a74d2340e6486d9e46861f5af67e
@@ -127,7 +127,7 @@
127
127
 
128
128
  ## V 0.6.0 2020/10/10
129
129
 
130
- ### FEATURE
130
+ ### FEATURES
131
131
 
132
132
  * read only WebAdmin (Major update)
133
133
  * API REST
@@ -135,7 +135,7 @@
135
135
 
136
136
  ## V 0.7.0
137
137
 
138
- ### FEATURE
138
+ ### FEATURES
139
139
 
140
140
  * sequences
141
141
  * API sequences
@@ -146,7 +146,51 @@
146
146
 
147
147
  ## V 0.8.0
148
148
 
149
- ### FEATURE
149
+ ### FEATURES
150
+
150
151
  * orchestrator rebuild
151
152
  * reshash config and reset + grammar and Cli
152
153
  * refacto config
154
+
155
+ ## V 0.8.1
156
+
157
+ ### FEATURES
158
+
159
+ * full Web UI features for Logs (R/W)
160
+ * API Logs Full
161
+
162
+ ## V 0.8.2
163
+
164
+ ### FIX
165
+ * WebAdmin UI bugs and cosmetics
166
+ * API (constants CLONE for exiter)
167
+
168
+ ## V 0.8.3
169
+
170
+ ### SECURITY
171
+ * kramdown dependencies update
172
+
173
+ ## V 0.8.4
174
+
175
+ ### FEATURES
176
+
177
+ * backends flushs #64
178
+ * get_results refactoring #62
179
+ * full process UI and API R/W
180
+
181
+ ### CHANGES
182
+
183
+ * delete_record purge
184
+
185
+ ### FIX
186
+
187
+ * always missing status for log history #65
188
+
189
+
190
+ ## V 0.8.5
191
+
192
+ ### FEATURE
193
+
194
+ * WebUI R/W commands, logs, processes
195
+ * cosmetics
196
+ * multiples fix, debugging
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.0
12
+ * DOC yardoc : https://www.rubydoc.info/gems/prometheus-splash/0.8.5
13
13
 
14
14
  Prometheus Logs and Batchs supervision over PushGateway
15
15
 
@@ -31,7 +31,7 @@ Splash is succesfully tested with Ruby 2.7.0, but it should works correctly with
31
31
 
32
32
  On Ubuntu :
33
33
 
34
- # apt install ruby
34
+ # apt install ruby ruby-dev
35
35
 
36
36
  In some use case, Splash also require some other components :
37
37
 
@@ -39,7 +39,7 @@ In some use case, Splash also require some other components :
39
39
  - RabbitMQ
40
40
 
41
41
  It's not strictly required, Redis is a real option for backend; you could configure backend to flat file, but
42
- RabbitMQ is required by the Splash Daemon when using host2host sequence execution.
42
+ RabbitMQ is required by the Splash Daemon when using host2host commands/sequence execution.
43
43
 
44
44
  Redis, is usefull when you need a centralized Splash management.
45
45
 
@@ -55,7 +55,7 @@ See Backends Configuration and Transports Configuration to specify this service
55
55
 
56
56
  Install with gem command :
57
57
 
58
- $ gem install splash
58
+ $ gem install prometheus-splash
59
59
 
60
60
 
61
61
  ## Configuration
@@ -68,7 +68,8 @@ As root or with rvmsudo, if you use RVM.
68
68
  👍 Splash Initialisation
69
69
  👍 Installing template file : /etc/splash_execution_report.tpl
70
70
  👍 Creating/Checking pid file path : /var/run/splash
71
- 👍 Creating/Checking trace file path : /var/run/spla
71
+ 👍 Creating/Checking trace file path : /var/run/splash/traces :
72
+ 💪 Splash Setup terminated successfully
72
73
 
73
74
  *NOTE : you can just type 'splash' withou any arguments, for the first setup because, Splash come with an automatic recovery mode, when configuration file is missing, run at the very beginnning of his the execution*
74
75
 
@@ -80,15 +81,12 @@ As root, edit /etc/splash.conf and adapt Prometheus Pushgateway Configuration :
80
81
  # vi /etc/splash.yml
81
82
  [..]
82
83
  :prometheus:
83
- :pushgateway:
84
- :host: <SERVER>
85
- :port: <PORT>
86
- [..]
84
+ :pushgateway: 'http://localhost:9091'
85
+ :url: 'http://localhost:9090'
86
+ :alertmanager: 'http://localhost:9093'
87
87
 
88
- With :
88
+ [..]
89
89
 
90
- - SERVER : IP or fqdn of the Gateway.
91
- - PORT : the specific TCP port of the Gateway.
92
90
 
93
91
  If you have already setup, you could use --preserve option to keep your active configuration and report file on place
94
92
  This is usefull for automatique Idempotent installation like with Ansible :
@@ -101,12 +99,12 @@ This is usefull for automatique Idempotent installation like with Ansible :
101
99
  As root or with rvmsudo, if you use RVM.
102
100
 
103
101
  # splash conf san
104
- Splash -> sanitycheck :
105
- * Config file : /etc/splash.yml : [OK]
106
- * PID Path : /tmp : [OK]
107
- * trace Path : /tmp/splash : [OK]
108
- * Prometheus PushGateway Service running : [OK]
109
- Sanitycheck finished with no errors
102
+ Splash -> sanitycheck :
103
+ 👍 Config file : /etc/splash.yml
104
+ 👍 PID Path : /var/run/splash
105
+ 👍 Trace Path : /var/run/splash/traces
106
+ 👍 Prometheus PushGateway Service running
107
+ 💪 Splash Sanitycheck terminated successfully
110
108
 
111
109
  *WARNING* : setup or Sanitycheck could precises errors if path defined in configuration is *Symbolic links*, type :mode.
112
110
  But it's not a problem for Splash to be operational.
@@ -123,8 +121,8 @@ For file/folders if problems is detected, it could be such as :
123
121
  run :
124
122
 
125
123
  $ splash config version
126
- Splash version : 0.6.0, Author : Romain GEORGES <gems@ultragreen.net>
127
- Ultragreen (c) 2020 BSD-2-Clause
124
+ Splash version : 0.8.2, Author : Romain GEORGES <gems@ultragreen.net>
125
+ Ultragreen (c) 2020 BSD-2-Clause
128
126
 
129
127
 
130
128
  ## Usage
@@ -140,18 +138,25 @@ In the /etc/splash.yml, you need to adapt default config to monitor your logs.
140
138
  [..]
141
139
  ### configuration of monitored logs
142
140
  :logs:
143
- - :log: /a/log/path.log
141
+ - :label: :a_label
142
+ :log: /a/log/path.log
144
143
  :pattern: <regexp pattern>
145
- - :log: /an/other/log/path.log
146
- :pattern: <regexp pattern
144
+ :retention:
145
+ :hours: 10
146
+ - :label: :an_other_label
147
+ :log: /an/other/log/path.log
148
+ :pattern: <regexp pattern>
149
+ :retention:
150
+ :days: 1
147
151
  - <etc...>
148
152
  [..]
149
153
 
150
154
  Config for log is a YAML list of Hash, with keys :
151
155
 
156
+ - :label : a Symbol like ':xxxxxx' used in Splash internaly to identify logs records
152
157
  - :log : a log absolut paths
153
158
  - :pattern : a regular expression splash need to detect
154
-
159
+ - :retention : a hash with keys like (:days or :hours) and a periode in value
155
160
 
156
161
  #### Prerequisite
157
162
 
@@ -169,11 +174,12 @@ or
169
174
 
170
175
  # slash logs help
171
176
  Commands:
172
- splash logs analyse # analyze logs in config
177
+ splash logs analyse # analyze logs defined in Splash config
173
178
  splash logs help [COMMAND] # Describe subcommands or one specific subcommand
174
- splash logs list # Show configured logs monitoring
175
- splash logs monitor # monitor logs in config
176
- splash logs show LOG # show configured log monitoring for LOG
179
+ splash logs history LABEL # show logs monitoring history
180
+ splash logs list # List all Splash configured logs monitoring
181
+ splash logs monitor # monitor logs defined in Splash config
182
+ splash logs show LOG # show Splash configured log monitoring for LOG
177
183
 
178
184
  *Typicallly, the way work with all Splash commands or subcommands*
179
185
 
@@ -188,9 +194,9 @@ Verify /tmp/test and /tmp/test2 not existence
188
194
  Verify configured logs :
189
195
 
190
196
  # splash logs list
191
- Splash configured log monitoring :
192
- * log monitor : /tmp/test
193
- * log monitor : /tmp/test2
197
+ Splash configured log monitoring :
198
+ 🔹 log monitor : /tmp/test label : log_app_1
199
+ 🔹 log monitor : /tmp/test2 label : log_app_2
194
200
 
195
201
  You could run list commands with --detail option , verify it with :
196
202
 
@@ -199,29 +205,31 @@ You could run list commands with --detail option , verify it with :
199
205
  like :
200
206
 
201
207
  # splash logs list --detail
202
- Splash configured log monitoring :
203
- * log monitor : /tmp/test
204
- -> pattern : /ERROR/
205
- * log monitor : /tmp/test2
206
- -> pattern : /ERROR/
208
+ Splash configured log monitoring :
209
+ 🔹 log monitor : /tmp/test label : log_app_1
210
+ pattern : /ERROR/
211
+ 🔹 log monitor : /tmp/test2 label : log_app_2
212
+ pattern : /ERROR/
207
213
 
208
- You cloud view a specific logs record detail with
209
214
 
210
- # splash logs show /tmp/test2
211
- Splash log monitor : /tmp/test2
212
- -> pattern : /ERROR/
215
+ You cloud view a specific logs record detail with :
216
+
217
+ # splash logs show /tmp/test
218
+ ℹ Splash log monitor : /tmp/test
219
+ 🔹 pattern : /ERROR/
220
+ 🔹 label : log_app_1
221
+
222
+ *this command Work with a logname or the label*
213
223
 
214
224
  Run a first analyse, you would see :
215
225
 
216
226
  # splash logs analyse
217
- SPlash Configured logs status :
218
- * Log : /tmp/test : [KO]
219
- - Detected pattern : ERROR
220
- - detailled Status : missing
221
- * Log : /tmp/test2 : [KO]
222
- - Detected pattern : ERROR
223
- - detailled Status : missing
224
- Global Status : [KO]
227
+ SPlash Configured log monitors :
228
+ 👎 Log : /tmp/test with label : log_app_1 : missing !
229
+ 🔹 Detected pattern : ERROR
230
+ 👎 Log : /tmp/test2 with label : log_app_2 : missing !
231
+ 🔹 Detected pattern : ERROR
232
+ 🚫 Global status : some error found
225
233
 
226
234
  Create empty Files, or without ERROR string in.
227
235
 
@@ -231,16 +239,14 @@ Create empty Files, or without ERROR string in.
231
239
  Re-run analyse :
232
240
 
233
241
  # splash log an
234
- SPlash Configured logs status :
235
- * Log : /tmp/test : [OK]
236
- - Detected pattern : ERROR
237
- - detailled Status : clean
238
- nb lines = 1
239
- * Log : /tmp/test2 : [OK]
240
- - Detected pattern : ERROR
241
- - detailled Status : clean
242
- nb lines = 0
243
- Global Status : [OK]
242
+ SPlash Configured log monitors :
243
+ 👍 Log : /tmp/test with label : log_app_1 : no errors
244
+ 🔹 Detected pattern : ERROR
245
+ 🔹 Nb lines = 1
246
+ 👍 Log : /tmp/test2 with label : log_app_2 : no errors
247
+ 🔹 Detected pattern : ERROR
248
+ 🔹 Nb lines = 0
249
+ 👍 Global status : no error found
244
250
 
245
251
  It's alright, log monitoring work fine.
246
252
 
@@ -249,15 +255,13 @@ It's alright, log monitoring work fine.
249
255
  Splash is made to run a specific daemon to do this job, but you could do one time, with :
250
256
 
251
257
  # splash logs monitor
252
- Sending metrics to Prometheus Pushgateway
253
- * Sending metrics for /tmp/test
254
- * Sending metrics for /tmp/test2
255
- Sending done.
258
+ Sending metrics to Prometheus Pushgateway
259
+ 👍 Sending metrics for log /tmp/test to Prometheus Pushgateway
260
+ 👍 Sending metrics for log /tmp/test2 to Prometheus Pushgateway
256
261
 
257
262
  if Prometheus Gateway is not running or misconfigured, you could see :
258
263
 
259
- Prometheus PushGateway Service IS NOT running
260
- Exit without notification.
264
+ Splash Service dependence missing : Prometheus Notification not send.
261
265
 
262
266
  Otherwise Prometheus PushGateway have received the metrics :
263
267
 
@@ -293,12 +297,16 @@ To see all the commands in the 'commands' submenu :
293
297
 
294
298
  $ splash commands
295
299
  Commands:
296
- splash commands help [COMMAND] # Describe subcommands or one specific subcommand
297
- splash commands lastrun COMMAND # Show last running result for specific configured command COMMAND
298
- splash commands list # Show configured commands
299
- splash commands run NAME # run for command/sequence or ack result
300
- splash commands show COMMAND # Show specific configured command COMMAND
301
- splash commands treeview # Show commands sequence tree
300
+ splash commands execute NAME # run for command/sequence or ack result
301
+ splash commands getreportlist # list all executions report results
302
+ splash commands help [COMMAND] # Describe subcommands or one specific subcommand
303
+ splash commands history LABEL # show commands executions history
304
+ splash commands lastrun COMMAND # Show last running result for specific configured command COMMAND
305
+ splash commands list # Show configured commands
306
+ splash commands onerun COMMAND -D, --date=DATE # Show running result for specific configured command COMMAND
307
+ splash commands schedule NAME # Schedule excution of command on Splash daemon
308
+ splash commands show COMMAND # Show specific configured command COMMAND
309
+ splash commands treeview # Show commands sequence tree
302
310
 
303
311
  #### Prepare test with default configuration
304
312
 
@@ -400,40 +408,44 @@ if you want to inject default configuration, again as root :
400
408
  You could list the defined commands, in your case :
401
409
 
402
410
  $ splash commands list
403
- Splash configured commands :
404
- * id_root
405
- * true_test
406
- * false_test
407
- * ls_slash_tmp
408
- * pwd
409
- * echo1
410
- * echo2
411
- * echo3
411
+ Splash configured commands :
412
+ 🔹 id_root
413
+ 🔹 true_test
414
+ 🔹 false_test
415
+ 🔹 ls_slash_tmp
416
+ 🔹 pwd
417
+ 🔹 echo1
418
+ 🔹 echo2
419
+ 🔹 echo3
420
+ 🔹 rand_sleep_5
421
+ 🔹 test_remote_call
422
+
412
423
 
413
424
  #### Show specific commands
414
425
 
415
426
  You could show a specific command :
416
427
 
417
428
  $ splash com show pwd
418
- Splash command : pwd
419
- - command line : 'pwd'
420
- - command description : 'run pwd'
421
- - command failure callback : 'echo2'
422
- - command success callback : 'echo1'
429
+ Splash command : pwd
430
+ 🔹 command line : 'pwd'
431
+ 🔹 command description : 'run pwd'
432
+ 🔹 command failure callback : 'echo2'
433
+ 🔹 command success callback : 'echo1'
434
+
423
435
 
424
436
  #### View Sequence execution for commands
425
437
 
426
438
  You could trace execution sequence for a commands as a tree, with :
427
439
 
428
440
  # splash com treeview
429
- Command : true_test
430
- * on failure => ls_slash_tmp
431
- * on success => echo1
432
- * on failure => echo3
433
- * on success => pwd
434
- * on failure => echo2
435
- * on success => echo1
436
- * on failure => echo3
441
+ Command : true_test
442
+ * on failure => ls_slash_tmp
443
+ * on success => echo1
444
+ * on failure => echo3
445
+ * on success => pwd
446
+ * on failure => echo2
447
+ * on success => echo1
448
+ * on failure => echo3
437
449
 
438
450
  In your sample, in all case :
439
451
  - :true_test return 0
@@ -451,10 +463,12 @@ commands execution sequence will be :
451
463
  Running a standalone command with ONLY as root
452
464
 
453
465
  # splash com execute echo1
454
- Executing command : 'echo1'
455
- * Tracefull execution
456
- => exitcode 0
457
- * Prometheus Gateway notified.
466
+ Executing command : 'echo1'
467
+ 🔹Tracefull execution
468
+ 👍 Command executed
469
+ exitcode 0
470
+ 👍 Sending metrics to Prometheus Pushgateway
471
+
458
472
 
459
473
  This command :
460
474
 
@@ -485,54 +499,59 @@ Splash allow execution of callback (:on_failure, :on_success), you have already
485
499
  In our example, we have see :true_test have a execution sequence, we're going to test this, as root :
486
500
 
487
501
  # splash com exe true_test
488
- Executing command : 'true_test'
489
- * Tracefull execution
490
- => exitcode 0
491
- * Prometheus Gateway notified.
492
- * On success callback : pwd
493
- Executing command : 'pwd'
494
- * Tracefull execution
495
- => exitcode 0
496
- * Prometheus Gateway notified.
497
- * On success callback : echo1
498
- Executing command : 'echo1'
499
- * Tracefull execution
500
- => exitcode 0
501
- * Prometheus Gateway notified.
502
+ Executing command : 'true_test'
503
+ 🔹 Tracefull execution
504
+ 👍 Command executed
505
+ exitcode 0
506
+ 👍 Sending metrics to Prometheus Pushgateway
507
+ 🔹 On success callback : pwd
508
+ Executing command : 'pwd'
509
+ 🔹 Tracefull execution
510
+ 👍 Command executed
511
+ exitcode 0
512
+ 👍 Sending metrics to Prometheus Pushgateway
513
+ 🔹 On success callback : echo1
514
+ Executing command : 'echo1'
515
+ 🔹 Tracefull execution
516
+ 👍 Command executed
517
+ ➡ exitcode 0
518
+ 👍 Sending metrics to Prometheus Pushgateway
519
+
502
520
 
503
521
  We could verify the sequence determined with lastrun command.
504
522
 
505
523
  If you want to prevent callback execution, as root :
506
524
 
507
525
  # splash com exe true_test --no-callback
508
- Executing command : 'true_test'
509
- * Tracefull execution
510
- => exitcode 0
511
- * Prometheus Gateway notified.
512
- * Without callbacks sequences
526
+ Executing command : 'true_test'
527
+ 🔹 Tracefull execution
528
+ 👍 Command executed
529
+ exitcode 0
530
+ 👍 Sending metrics to Prometheus Pushgateway
531
+ 🔹 Without callbacks sequences
513
532
 
514
533
  #### Display the last execution trace for a command
515
534
 
516
535
  If you want to view the last execution trace for commande, (only if executed with --trace : default)
517
536
 
518
- # splash com lastrun
519
- Splash command pwd previous execution report:
537
+ # splash com lastrun pwd
538
+ Splash command pwd previous execution report:
520
539
 
521
540
  Command Execution report
522
541
  ========================
523
542
 
524
- Date START: 2020-04-07T18:25:22+02:00
525
- Date END: 2020-04-07T18:25:22+02:00
543
+ Date START: 2020-10-28T13:38:36+01:00
544
+ Date END: 2020-10-28T13:38:36+01:00
526
545
  Command : pwd
527
546
  full command line : pwd
528
547
  Description : run pwd
529
- errorcode : pid 86782 exit 0
530
- Execution time (sec) : 0.006568
548
+ errorcode : pid 10958 exit 0
549
+ Execution time (sec) : 0.00737092
531
550
 
532
551
  STDOUT:
533
552
  -------
534
553
 
535
- /Users/ruydiaz/labo/prometheus-splash
554
+ /home/xxx/prometheus-splash
536
555
 
537
556
 
538
557
 
@@ -540,6 +559,8 @@ If you want to view the last execution trace for commande, (only if executed wi
540
559
  -------
541
560
 
542
561
 
562
+
563
+
543
564
  Lastrun could receive the --hostname option to get the execution report of command
544
565
 
545
566
 
@@ -554,6 +575,9 @@ For the moment Splash come with two types of backend :
554
575
  backend are usable for :
555
576
 
556
577
  - execution trace
578
+ - transfers_trace
579
+ - logs_trace
580
+ - process_trace
557
581
 
558
582
  ##### File backend
559
583
 
@@ -597,20 +621,22 @@ Edit /etc/splash.yml, as root :
597
621
  - :base must be set as the Redis base number (default: 1)
598
622
  - :auth should be set if Redis need an simple authentification key <mykey>
599
623
 
600
- ##### Prometheus PushGateway configuration
624
+ ##### Prometheus configuration
601
625
 
602
- Prometheus PushGateway could be configured in /etc/splash.yaml
626
+ Prometheus services could be configured in /etc/splash.yaml
603
627
 
604
628
  # vi /etc/splash.yml
605
629
  [...]
606
630
  :prometheus:
607
- :pushgateway:
608
- :host: "localhost"
609
- :port: 9091
631
+ :pushgateway: http://localhost:9091
632
+ :url: http://localhost:9090
633
+ :alertmanager: http://localhost:9093
634
+
610
635
  [...]
611
636
 
612
- - :host should be set as the Prometheus PushGateway hostname (default: localhost)
613
- - :port should be set as the Prometheus PushGateway port (default: 9091)
637
+ - :pushgateway should be set as the Prometheus PushGateway url (default: http://localhost:9091 )
638
+ - :url should be set as the Prometheus main service (default: http://localhost:9090)
639
+ - :alertmanager should be set as the Prometheus Alertmanager service (default: http://localhost:9093)
614
640
 
615
641
  ### The Splash daemon
616
642
 
@@ -621,15 +647,144 @@ We're going to discover the Big part of Splash the Daemon, usefull to :
621
647
  - orchestration
622
648
  - scheduling
623
649
  - Log monitoring (without CRON scheduling)
650
+ - Process monitoring (without CRON scheduling)
651
+ - Transfers scheduling (TODO)
624
652
  - host2host sequences execution (optionnal )
625
653
 
654
+
655
+ #### Prerequisite
656
+
657
+ Splash Daemon requiere Rabbitmq Configured and launched
658
+ if you try to run Splash with Rabbitmq, it will be failed :
659
+
660
+ # sudo splash dae start
661
+ ⛔ Splash Service dependence missing : RabbitMQ Transport not available.
662
+
663
+ *WARNING : if RabbitMQ service shutdown, Splash will shutdown also !*
664
+
665
+ You cloud configure RabbitMQ in the /etc/splash.yml :
666
+
667
+ [...]
668
+ :transports:
669
+ :active: :rabbitmq
670
+ :rabbitmq:
671
+ :vhost: "/"
672
+ :port: 5672
673
+ :host: localhost
674
+ [...]
675
+
676
+ *RabbitMQ, is the only transport service usable actually in Splash*
677
+
678
+ Where :
679
+ * vhost: is the RabbitMQ vhost used to store Splash Queues
680
+ * port : the TCP RabbitMQ port (default : 5672)
681
+ * Host : the hostname or IP of the RabbitMQ service (default : localhost)
682
+
683
+ #### the Daemon Splash subcommand
684
+
685
+ run this command :
686
+
687
+ # splash daemon
688
+ Commands:
689
+ splash daemon getjobs # send a get_jobs verb to HOSTNAME daemon over transport (need an active tranport), Typicallly Ra...
690
+ splash daemon getjobs # send a reset verb to HOSTNAME daemon over transport (need an active tranport), Typicallly RabbitMQ
691
+ splash daemon help [COMMAND] # Describe subcommands or one specific subcommand
692
+ splash daemon ping HOSTNAME # send a ping to HOSTNAME daemon over transport (need an active tranport), Typicallly RabbitMQ
693
+ splash daemon purge # Purge Transport Input queue of Daemon
694
+ splash daemon start # Starting Splash Daemon
695
+ splash daemon status # Splash Daemon status
696
+ splash daemon stop # Stopping Splash Daemon
697
+
626
698
  #### Controlling the daemon
627
699
 
628
- TODO
700
+ ##### Running Daemon
701
+
702
+ # sudo splash dae start
703
+ ℹ Queue : splash.live.input purged
704
+ 👍 Splash Daemon Started, with PID : 16904
705
+ 💪 Splash Daemon successfully loaded.
706
+
707
+ Start command support multiples options, you cloud see it by typing :
708
+
709
+ # sudo splash dae help start
710
+ Usage:
711
+ splash daemon start
712
+
713
+ Options:
714
+ -F, [--foreground], [--no-foreground]
715
+ [--purge], [--no-purge]
716
+ # Default: true
717
+ [--scheduling], [--no-scheduling]
718
+ # Default: true
719
+
720
+ Description:
721
+ Starting Splash Daemon
722
+
723
+ With --foreground, run Splash in foreground
724
+
725
+ With --no-scheduling, inhibit commands scheduling
726
+
727
+ With --no-purge, inhibit purge Input Queue for Splash Daemon
728
+
729
+
730
+ ##### Status Daemon
731
+
732
+ if daemon is stopped :
733
+
734
+ # sudo splash dae status
735
+ 🔹 Splash Process not found
736
+ 🔹 and PID file don't exist
737
+ 💪 Status OK
738
+
739
+
740
+ If daemon is running :
741
+
742
+ # splash dae status
743
+ 🔹 Splash Process is running with PID 974
744
+ 🔹 and PID file exist with PID 974
745
+ 💪 Status OK
746
+
747
+
748
+ ##### Stopping Daemon
749
+
750
+ # sudo splash dae stop
751
+ 💪 Splash stopped succesfully
752
+
629
753
 
630
754
  #### Configuring the daemon
631
755
 
632
- TODO
756
+ the configuration of the daemon could be done in the /etc/splash.yml
757
+ [...]
758
+ :daemon:
759
+ :logmon_scheduling:
760
+ :every: 20s
761
+ :metrics_scheduling:
762
+ :every: 15s
763
+ :procmon_scheduling:
764
+ :every: 20s
765
+ :process_name: 'Splash : daemon.'
766
+ :files:
767
+ :stdout_trace: stdout.txt
768
+ :stderr_trace: stderr.txt
769
+ :pid_file: splash.pid
770
+ [...]
771
+
772
+ Where :
773
+
774
+ * logmon_scheduling : (Hash) a scheduling for Log monitoring, (default: every 20s) it support :
775
+ * :every: "<timing>" ex: "1s", "3m", "2h"
776
+ * :at: "<date/time>" ex: "2030/12/12 23:30:00"
777
+ * :cron: * * * * * a cron format
778
+
779
+
780
+ * metrics_scheduling : (Hash) a scheduling for internals metrics for daemon, (default: every 20s), scheduled as logmon_scheduling
781
+
782
+ * procmon_scheduling : (Hash) a scheduling for Process monitoring, (default: every 20s), scheduled as logmon_scheduling
783
+
784
+ [Rufus Scheduler Doc](https://github.com/jmettraux/rufus-scheduler)
785
+
786
+
787
+ #### Daemon metrics
633
788
 
634
789
 
635
790
  ### Ecosystem
@@ -656,74 +811,141 @@ TODO
656
811
 
657
812
 
658
813
 
659
- # the only one non-overridable by the configuration
660
- CONFIG_FILE = "/etc/splash.yml"
814
+ # Current splash version
815
+ VERSION = "0.8.3"
816
+ # the path to th config file, not overridable by config
817
+ CONFIG_FILE = "/etc/splash.yml"
818
+ # the default execution trace_path if backend file
819
+ TRACE_PATH="/var/run/splash"
820
+ # the default pid file path
821
+ PID_PATH="/var/run"
822
+
823
+
824
+ # default scheduling criteria for log monitoring
825
+ DAEMON_LOGMON_SCHEDULING={ :every => '20s'}
826
+ # default scheduling criteria for metrics notifications
827
+ DAEMON_METRICS_SCHEDULING={ :every => '15s'}
828
+ # default scheduling criteria for process monitoring
829
+ DAEMON_PROCMON_SCHEDULING={ :every => '20s'}
830
+
831
+ # the display name of daemon in proc info (ps/top)
832
+ DAEMON_PROCESS_NAME="Splash : daemon."
833
+ # the default pid file name
834
+ DAEMON_PID_FILE="splash.pid"
835
+ # the default sdtout trace file
836
+ DAEMON_STDOUT_TRACE="stdout.txt"
837
+ # the default sdterr trace file
838
+ DAEMON_STDERR_TRACE="stderr.txt"
839
+
840
+ # the Author name
841
+ AUTHOR="Romain GEORGES"
842
+ # the maintainer mail
843
+ EMAIL = "gems@ultragreen.net"
844
+ # legal Copyright (c) 2020 Copyright Utragreen All Rights Reserved.
845
+ COPYRIGHT="Ultragreen (c) 2020"
846
+ # type of licence
847
+ LICENSE="BSD-2-Clause"
848
+
849
+ # the default prometheus pushgateway URL
850
+ PROMETHEUS_PUSHGATEWAY_URL = 'http://localhost:9091/'
851
+
852
+ # the default prometheus Alertmanager URL
853
+ PROMETHEUS_ALERTMANAGER_URL = 'http://localhost:9092/'
854
+
855
+ # the default prometheus URL
856
+ PROMETHEUS_URL = "http://localhost:9090/"
857
+
858
+ # the default path fo execution report template
859
+ EXECUTION_TEMPLATE="/etc/splash_execution_report.tpl"
860
+
861
+ # the list of authorized tokens for template, carefull override,
862
+ EXECUTION_TEMPLATE_TOKENS_LIST = [:end_date,:start_date,:cmd_name,:cmd_line,:stdout,:stderr,:desc,:status,:exec_time]
863
+
864
+ # backends default settings
865
+ BACKENDS_STRUCT = { :list => [:file,:redis],
866
+ :stores => { :execution_trace => { :type => :file, :path => "/var/run/splash" }}}
867
+ # transports default settings
868
+ TRANSPORTS_STRUCT = { :list => [:rabbitmq],
869
+ :active => :rabbitmq,
870
+ :rabbitmq => { :port => 5672, :host => "localhost", :vhost => '/'} }
871
+
872
+ # loggers default settings
873
+ LOGGERS_STRUCT = { :list => [:cli,:daemon, :dual, :web],
874
+ :default => :cli,
875
+ :level => :info,
876
+ :daemon => {:file => '/var/log/splash.log'},
877
+ :web => {:file => '/var/log/splash_web.log'},
878
+ :cli => {:color => true, :emoji => true } }
879
+
880
+ WEBADMIN_IP = "127.0.0.1"
881
+ WEBADMIN_PORT = "9234"
882
+ WEBADMIN_PROXY = false
883
+ # the display name of daemon in proc info (ps/top)
884
+ WEBADMIN_PROCESS_NAME="Splash : WebAdmin."
885
+ # the default pid file path
886
+ WEBADMIN_PID_PATH="/var/run"
887
+ # the default pid file name
888
+ WEBADMIN_PID_FILE="splash.pid"
889
+ # the default sdtout trace file
890
+ WEBADMIN_STDOUT_TRACE="stdout.txt"
891
+ # the default sdterr trace file
892
+ WEBADMIN_STDERR_TRACE="stderr.txt"
893
+
894
+ # default retention for trace
895
+ DEFAULT_RETENTION=1
661
896
 
662
897
 
663
- TRACE_PATH="/var/run/splash"
664
898
 
665
- DAEMON_LOGMON_SCHEDULING={ :every => '20s'}
666
- DAEMON_PROCESS_NAME="Splash : daemon."
667
- DAEMON_PID_PATH="/var/run"
668
- DAEMON_PID_FILE="splash.pid"
669
- DAEMON_STDOUT_TRACE="stdout.txt"
670
- DAEMON_STDERR_TRACE="stderr.txt"
899
+ #### Splash CLI return code significations
671
900
 
672
- AUTHOR="Romain GEORGES"
673
- EMAIL = "gems@ultragreen.net"
674
- COPYRIGHT="Ultragreen (c) 2020"
675
- LICENSE="BSD-2-Clause"
676
901
 
677
- PROMETHEUS_PUSHGATEWAY_HOST = "localhost"
678
- PROMETHEUS_PUSHGATEWAY_PORT = "9091"
902
+ EXIT_MAP= {
679
903
 
680
- EXECUTION_TEMPLATE="/etc/splash_execution_report.tpl"
681
- EXECUTION_TEMPLATE_TOKENS_LIST = [:end_date,:start_date,:cmd_name,:cmd_line,:stdout,:stderr,:desc,:status,:exec_time]
904
+ # context execution
905
+ :not_root => {:message => "This operation need to be run as root (use sudo or rvmsudo)", :code => 10},
906
+ :options_incompatibility => {:message => "Options incompatibility", :code => 40},
907
+ :service_dependence_missing => {:message => "Splash Service dependence missing", :code => 60},
682
908
 
683
- BACKENDS_STRUCT = { :list => [:file,:redis],
684
- :stores => { :execution_trace => { :type => :file, :path => "/var/run/splash" }}}
685
- TRANSPORTS_STRUCT = { :list => [:rabbitmq],
686
- :active => :rabbitmq,
687
- :rabbitmq => { :url => 'amqp://localhost/'} }
909
+ # config
910
+ :specific_config_required => {:message => "Specific configuration required", :code => 30},
911
+ :splash_setup_error => {:message => "Splash Setup terminated unsuccessfully", :code => 25},
912
+ :splash_setup_success => {:message => "Splash Setup terminated successfully", :code => 0},
913
+ :splash_sanitycheck_error => {:message => "Splash Sanitycheck terminated unsuccessfully", :code => 20},
914
+ :splash_sanitycheck_success => {:message => "Splash Sanitycheck terminated successfully", :code => 0},
915
+ :configuration_error => {:message => "Splash Configuration Error", :code => 50},
688
916
 
689
917
 
690
- #### Splash CLI return code significations
918
+ # global
919
+ :quiet_exit => {:code => 0},
920
+ :error_exit => {:code => 99, :message => "Operation failure"},
691
921
 
922
+ # events
923
+ :interrupt => {:message => "Splash user operation interrupted", :code => 33},
692
924
 
693
- # context execution
694
- :not_root => {:message => "This operation need to be run as root (use sudo or rvmsudo)", :code => 10},
695
- :options_incompatibility => {:message => "Options incompatibility", :code => 40},
696
- :service_dependence_missing => {:message => "Splash Service dependence missing", :code => 60},
925
+ # request
926
+ :not_found => {:message => "Object not found", :code => 44},
927
+ :already_exist => {:message => "Object already exist", :code => 48},
697
928
 
698
- # config
699
- :specific_config_required => {:message => "Specific configuration required", :code => 30},
700
- :splash_setup_error => {:message => "Splash Setup terminated unsuccessfully", :code => 25},
701
- :splash_setup_success => {:message => "Splash Setup terminated successfully", :code => 0},
702
- :splash_sanitycheck_error => {:message => "Splash Sanitycheck terminated unsuccessfully", :code => 20},
703
- :splash_sanitycheck_success => {:message => "Splash Sanitycheck terminated successfully", :code => 0},
704
- :configuration_error => {:message => "Splash Configuration Error", :code => 50},
929
+ # daemon
930
+ :status_ok => {:message => "Status OK", :code => 0},
931
+ :status_ko => {:message => "Status KO", :code => 31}
705
932
 
933
+ }
706
934
 
707
- # global
708
- :quiet_exit => {:code => 0},
709
935
 
710
- # events
711
- :interrupt => {:message => "Splash user operation interrupted", :code => 33},
936
+ ### The Splash WebAdmin
712
937
 
713
- # request
714
- :not_found => {:message => "Object not found", :code => 44},
715
- :already_exist => {:message => "Object already exist", :code => 48},
938
+ #### Controlling WebAdmin
716
939
 
717
- # daemon
718
- :status_ok => {:message => "Status OK", :code => 0},
719
- :status_ko => {:message => "Status KO", :code => 31}
940
+ #### Starting
941
+ #### Stopping
942
+ #### Status
720
943
 
721
944
 
722
- ### In the Futur ?
945
+ #### Accessing WebAdmin
723
946
 
724
- - IHM
725
- - Webservice
726
947
 
948
+ ### the SPlash API
727
949
 
728
950
 
729
951
  ## Contributing