prometheus-splash 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +58 -60
  3. data/bin/splash +3 -0
  4. data/config/splash.yml +15 -2
  5. data/lib/splash/backends.rb +6 -0
  6. data/lib/splash/backends/file.rb +36 -0
  7. data/lib/splash/backends/redis.rb +44 -1
  8. data/lib/splash/cli.rb +7 -3
  9. data/lib/splash/cli/commands.rb +11 -4
  10. data/lib/splash/cli/config.rb +9 -1
  11. data/lib/splash/cli/daemon.rb +8 -1
  12. data/lib/splash/cli/documentation.rb +5 -2
  13. data/lib/splash/cli/logs.rb +14 -6
  14. data/lib/splash/cli/process.rb +9 -0
  15. data/lib/splash/cli/webadmin.rb +46 -0
  16. data/lib/splash/commands.rb +23 -2
  17. data/lib/splash/config.rb +141 -1
  18. data/lib/splash/config/flush.rb +9 -1
  19. data/lib/splash/config/sanitycheck.rb +6 -1
  20. data/lib/splash/config/service.rb +8 -1
  21. data/lib/splash/config/setup.rb +8 -3
  22. data/lib/splash/constants.rb +30 -2
  23. data/lib/splash/daemon.rb +5 -1
  24. data/lib/splash/daemon/controller.rb +21 -1
  25. data/lib/splash/daemon/metrics.rb +22 -7
  26. data/lib/splash/daemon/orchestrator.rb +21 -3
  27. data/lib/splash/daemon/orchestrator/grammar.rb +25 -5
  28. data/lib/splash/daemon/orchestrator/hooks.rb +10 -0
  29. data/lib/splash/dependencies.rb +10 -1
  30. data/lib/splash/exiter.rb +14 -0
  31. data/lib/splash/helpers.rb +69 -45
  32. data/lib/splash/loggers.rb +30 -4
  33. data/lib/splash/loggers/cli.rb +18 -3
  34. data/lib/splash/loggers/daemon.rb +14 -3
  35. data/lib/splash/loggers/dual.rb +14 -1
  36. data/lib/splash/loggers/web.rb +51 -0
  37. data/lib/splash/logs.rb +15 -4
  38. data/lib/splash/processes.rb +17 -5
  39. data/lib/splash/templates.rb +10 -0
  40. data/lib/splash/transports.rb +9 -0
  41. data/lib/splash/transports/rabbitmq.rb +33 -3
  42. data/lib/splash/webadmin.rb +122 -0
  43. data/lib/splash/webadmin/api/routes/commands.rb +28 -0
  44. data/lib/splash/webadmin/api/routes/config.rb +10 -0
  45. data/lib/splash/webadmin/api/routes/init.rb +2 -0
  46. data/lib/splash/webadmin/api/routes/logs.rb +59 -0
  47. data/lib/splash/webadmin/api/routes/process.rb +60 -0
  48. data/lib/splash/webadmin/main.rb +26 -0
  49. data/lib/splash/webadmin/portal/controllers/commands.rb +7 -0
  50. data/lib/splash/webadmin/portal/controllers/documentation.rb +6 -0
  51. data/lib/splash/webadmin/portal/controllers/home.rb +12 -0
  52. data/lib/splash/webadmin/portal/controllers/logs.rb +14 -0
  53. data/lib/splash/webadmin/portal/controllers/notfound.rb +5 -0
  54. data/lib/splash/webadmin/portal/controllers/processes.rb +14 -0
  55. data/lib/splash/webadmin/portal/controllers/proxy.rb +30 -0
  56. data/lib/splash/webadmin/portal/controllers/restclient.rb +19 -0
  57. data/lib/splash/webadmin/portal/init.rb +11 -0
  58. data/lib/splash/webadmin/portal/public/css/ultragreen.css +8544 -0
  59. data/lib/splash/webadmin/portal/public/fonts/FontAwesome.otf +0 -0
  60. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.ttf +0 -0
  61. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff +0 -0
  62. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff2 +0 -0
  63. data/lib/splash/webadmin/portal/public/images/logo_splash.png +0 -0
  64. data/lib/splash/webadmin/portal/public/images/logo_splash_reduce.png +0 -0
  65. data/lib/splash/webadmin/portal/public/images/logo_splash_tiny.png +0 -0
  66. data/lib/splash/webadmin/portal/views/commands.slim +49 -0
  67. data/lib/splash/webadmin/portal/views/documentation.slim +3 -0
  68. data/lib/splash/webadmin/portal/views/home.slim +78 -0
  69. data/lib/splash/webadmin/portal/views/layout.slim +43 -0
  70. data/lib/splash/webadmin/portal/views/logs.slim +32 -0
  71. data/lib/splash/webadmin/portal/views/nav.slim +17 -0
  72. data/lib/splash/webadmin/portal/views/not_found.slim +3 -0
  73. data/lib/splash/webadmin/portal/views/processes.slim +29 -0
  74. data/lib/splash/webadmin/portal/views/proxy.slim +13 -0
  75. data/lib/splash/webadmin/portal/views/restclient.slim +41 -0
  76. data/lib/splash/webadmin/portal/views/restclient_result.slim +29 -0
  77. data/prometheus-splash.gemspec +6 -0
  78. data/spec/helpers_spec.rb +119 -0
  79. metadata +128 -5
@@ -1,7 +1,9 @@
1
1
  # coding: utf-8
2
- module CLISplash
3
2
 
3
+ # module for all Thor subcommands
4
+ module CLISplash
4
5
 
6
+ # Thor inherited class for commands management
5
7
  class Commands < Thor
6
8
  include Splash::Config
7
9
  include Splash::Backends
@@ -11,6 +13,8 @@ module CLISplash
11
13
  include Splash::Loggers
12
14
  include Splash::Commands
13
15
 
16
+
17
+ # Thor method : execution of command
14
18
  desc "execute NAME", "run for command/sequence or ack result"
15
19
  long_desc <<-LONGDESC
16
20
  execute command or sequence or ack result\n
@@ -74,6 +78,7 @@ module CLISplash
74
78
  end
75
79
 
76
80
 
81
+ # Thor method : scheduling commands
77
82
  desc "schedule NAME", "Schedule excution of command on Splash daemon"
78
83
  long_desc <<-LONGDESC
79
84
  Schedule excution of command on Splash daemon\n
@@ -116,7 +121,7 @@ module CLISplash
116
121
 
117
122
  end
118
123
 
119
-
124
+ # Thor method : getting a treeview of sequence of commands
120
125
  desc "treeview", "Show commands sequence tree"
121
126
  long_desc <<-LONGDESC
122
127
  Show commands sequence tree\n
@@ -164,6 +169,7 @@ module CLISplash
164
169
  end
165
170
 
166
171
 
172
+ # Thor method : getting the list of avaible commands in splash config
167
173
  desc "list", "Show configured commands"
168
174
  long_desc <<-LONGDESC
169
175
  Show configured commands\n
@@ -213,7 +219,7 @@ module CLISplash
213
219
  splash_exit case: :quiet_exit
214
220
  end
215
221
 
216
-
222
+ # Thor method: getting informations about a specific splash configuration defined command
217
223
  desc "show COMMAND", "Show specific configured command COMMAND"
218
224
  long_desc <<-LONGDESC
219
225
  Show specific configured command COMMAND\n
@@ -259,7 +265,7 @@ module CLISplash
259
265
  end
260
266
  end
261
267
 
262
-
268
+ # Thor method : getting information on the last execution of a command
263
269
  desc "lastrun COMMAND", "Show last running result for specific configured command COMMAND"
264
270
  long_desc <<-LONGDESC
265
271
  Show last running result for specific configured command COMMAND\n
@@ -299,6 +305,7 @@ module CLISplash
299
305
  end
300
306
  end
301
307
 
308
+ # Thor method : getting the list of avaibles executions reports
302
309
  desc "getreportlist", "list all executions report results "
303
310
  long_desc <<-LONGDESC
304
311
  list all executions report results\n
@@ -1,13 +1,16 @@
1
1
  # coding: utf-8
2
+
3
+ # module for all Thor subcommands
2
4
  module CLISplash
3
5
 
6
+ # Thor inherited class for configuration management
4
7
  class Config < Thor
5
8
  include Splash::ConfigUtilities
6
9
  include Splash::Helpers
7
10
  include Splash::Exiter
8
11
  include Splash::Loggers
9
12
 
10
-
13
+ # Thor method : running of Splash setup
11
14
  desc "setup", "Setup installation fo Splash"
12
15
  long_desc <<-LONGDESC
13
16
  Setup installation fo Splash\n
@@ -19,12 +22,14 @@ module CLISplash
19
22
  splash_exit acase
20
23
  end
21
24
 
25
+ # Thor method : running of Splash sanitycheck
22
26
  desc "sanitycheck", "Verify installation fo Splash"
23
27
  def sanitycheck
24
28
  acase = run_as_root :checkconfig
25
29
  splash_exit acase
26
30
  end
27
31
 
32
+ # Thor method : Getting the current Splash version
28
33
  desc "version", "Display current Splash version"
29
34
  def version
30
35
  log = get_logger
@@ -34,12 +39,15 @@ module CLISplash
34
39
  splash_exit case: :quiet_exit
35
40
  end
36
41
 
42
+ # Thor method : Installing Splashd Systemd service file
37
43
  desc "service", "Install Splashd Systemd service"
38
44
  def service
39
45
  acase = run_as_root :addservice
40
46
  splash_exit acase
41
47
  end
42
48
 
49
+
50
+ # Thor method : flushing configured backend
43
51
  desc "flushbackend", "Flush configured backend"
44
52
  def flushbackend
45
53
  acase = run_as_root :flush_backend
@@ -1,6 +1,9 @@
1
1
  # coding: utf-8
2
+
3
+ # module for all Thor subcommands
2
4
  module CLISplash
3
5
 
6
+ # Thor inherited class for splashd daemon management
4
7
  class CLIController < Thor
5
8
  include Splash::Daemon::Controller
6
9
  include Splash::Transports
@@ -8,6 +11,7 @@ module CLISplash
8
11
  include Splash::Loggers
9
12
 
10
13
 
14
+ # Thor method : starting Splashd
11
15
  option :foreground, :type => :boolean, :aliases => "-F"
12
16
  option :purge, :type => :boolean, default: true
13
17
  option :scheduling, :type => :boolean, default: true
@@ -23,7 +27,7 @@ module CLISplash
23
27
  splash_exit acase
24
28
  end
25
29
 
26
-
30
+ # Thor method : purge transport input queue of Splashd daemon
27
31
  desc "purge", "Purge Transport Input queue of Daemon"
28
32
  def purge
29
33
  log = get_logger
@@ -39,18 +43,21 @@ module CLISplash
39
43
  end
40
44
  end
41
45
 
46
+ # Thor method : stopping Splashd
42
47
  desc "stop", "Stopping Splash Daemon"
43
48
  def stop
44
49
  acase = run_as_root :stopdaemon
45
50
  splash_exit acase
46
51
  end
47
52
 
53
+ # Thor method : getting execution status of Splashd
48
54
  desc "status", "Splash Daemon status"
49
55
  def status
50
56
  acase = run_as_root :statusdaemon
51
57
  splash_exit acase
52
58
  end
53
59
 
60
+ # Thor method : sending ping verb over transport in the input queue of Splashd
54
61
  desc "ping HOSTNAME", "send a ping to HOSTNAME daemon over transport (need an active tranport), Typicallly RabbitMQ"
55
62
  def ping(hostname=Socket.gethostname)
56
63
  log = get_logger
@@ -1,11 +1,14 @@
1
1
  # coding: utf-8
2
+
3
+ # module for all Thor subcommands
2
4
  module CLISplash
3
5
 
6
+ # Thor inherited class for documentation management
4
7
  class Documentation < Thor
5
8
  include Splash::Config
6
9
  include Splash::Exiter
7
10
 
8
-
11
+ # Thor method : display the readme file Typicallly formatted in Markdown
9
12
  desc "readme", "Display README file"
10
13
  option :formatted, :type => :boolean, :default => true
11
14
  def readme
@@ -14,7 +17,7 @@ module CLISplash
14
17
  if options[:formatted] then
15
18
  content = TTY::Markdown.parse_file(filename)
16
19
  else
17
- conten = File::readlines(filename).join
20
+ content = File::readlines(filename).join
18
21
  end
19
22
  pager = TTY::Pager.new
20
23
  pager.page(content)
@@ -1,12 +1,15 @@
1
1
  # coding: utf-8
2
+
3
+ # module for all Thor subcommands
2
4
  module CLISplash
3
5
 
6
+ # Thor inherited class for documentation management
4
7
  class Logs < Thor
5
8
  include Splash::Config
6
9
  include Splash::Exiter
7
10
  include Splash::Logs
8
11
 
9
-
12
+ # Thor method : running Splash configured logs monitors analyse
10
13
  desc "analyse", "analyze logs defined in Splash config"
11
14
  def analyse
12
15
  log = get_logger
@@ -16,14 +19,14 @@ module CLISplash
16
19
  full_status = true
17
20
  results.output.each do |result|
18
21
  if result[:status] == :clean then
19
- log.ok "Log : #{result[:log]} : no errors"
22
+ log.ok "Log : #{result[:log]} with label : #{result[:label]} : no errors"
20
23
  log.item "Detected pattern : #{result[:pattern]}"
21
24
  log.item "Nb lines = #{result[:lines]}"
22
25
  elsif result[:status] == :missing then
23
- log.ko "Log : #{result[:log]} : missing !"
26
+ log.ko "Log : #{result[:log]} with label : #{result[:label]} : missing !"
24
27
  log.item "Detected pattern : #{result[:pattern]}"
25
28
  else
26
- log.ko "Log : #{result[:log]} : #{result[:count]} errors"
29
+ log.ko "Log : #{result[:log]} with label : #{result[:label]} : #{result[:count]} errors"
27
30
  log.item "Detected pattern : #{result[:pattern]}"
28
31
  log.item "Nb lines = #{result[:lines]}"
29
32
  end
@@ -39,6 +42,8 @@ module CLISplash
39
42
  splash_exit case: :quiet_exit
40
43
  end
41
44
 
45
+
46
+ # Thor method : running Splash configured logs monitors analyse and sending to Prometheus Pushgateway
42
47
  desc "monitor", "monitor logs defined in Splash config"
43
48
  def monitor
44
49
  log = get_logger
@@ -49,20 +54,23 @@ module CLISplash
49
54
 
50
55
  end
51
56
 
57
+ # Thor method : display a specific Splash configured log monitor
52
58
  desc "show LOG", "show Splash configured log monitoring for LOG"
53
59
  def show(logrecord)
54
60
  log = get_logger
55
- log_record_set = get_config.logs.select{|item| item[:log] == logrecord }
61
+ log_record_set = get_config.logs.select{|item| item[:log] == logrecord or item[:label] == logrecord.to_sym}
56
62
  unless log_record_set.empty? then
57
63
  record = log_record_set.first
58
64
  log.info "Splash log monitor : #{record[:log]}"
59
65
  log.item "pattern : /#{record[:pattern]}/"
66
+ log.item "label : #{record[:label]}"
60
67
  splash_exit case: :quiet_exit
61
68
  else
62
69
  splash_exit case: :not_found, :more => "log not configured"
63
70
  end
64
71
  end
65
72
 
73
+ # Thor method : display the full list of Splash configured log monitors
66
74
  desc "list", "List all Splash configured logs monitoring"
67
75
  long_desc <<-LONGDESC
68
76
  Show configured logs monitoring\n
@@ -75,7 +83,7 @@ module CLISplash
75
83
  log_record_set = get_config.logs
76
84
  log.ko 'No configured commands found' if log_record_set.empty?
77
85
  log_record_set.each do |record|
78
- log.item "log monitor : #{record[:log]}"
86
+ log.item "log monitor : #{record[:log]} label : #{record[:label]}"
79
87
  if options[:detail] then
80
88
  log.arrow "pattern : /#{record[:pattern]}/"
81
89
  end
@@ -1,10 +1,15 @@
1
+ # coding: utf-8
2
+
3
+ # module for all Thor subcommands
1
4
  module CLISplash
2
5
 
6
+ # Thor inherited class for Processes management
3
7
  class Processes < Thor
4
8
  include Splash::Config
5
9
  include Splash::Exiter
6
10
  include Splash::Processes
7
11
 
12
+ # Thor method : unning Splash configured processes monitors analyse
8
13
  desc "analyse", "analyze processes defined in Splash config"
9
14
  def analyse
10
15
  log = get_logger
@@ -40,6 +45,8 @@ module CLISplash
40
45
  splash_exit case: :quiet_exit
41
46
  end
42
47
 
48
+
49
+ # Thor method : running Splash configured processes monitors analyse and sending to Prometheus Pushgateway
43
50
  desc "monitor", "monitor processes defined in Splash config"
44
51
  def monitor
45
52
  log = get_logger
@@ -49,6 +56,7 @@ module CLISplash
49
56
  splash_exit result.notify
50
57
  end
51
58
 
59
+ # Thor method : display a specific Splash configured process monitor
52
60
  desc "show PROCESS", "show Splash configured process record for PROCESS"
53
61
  def show(record)
54
62
  log = get_logger
@@ -66,6 +74,7 @@ module CLISplash
66
74
  end
67
75
  end
68
76
 
77
+ # Thor method : display the full list of Splash configured processes monitors
69
78
  desc "list", "List all Splash configured process records"
70
79
  long_desc <<-LONGDESC
71
80
  List all Splash configured processes record\n
@@ -0,0 +1,46 @@
1
+ # coding: utf-8
2
+
3
+ # module for all Thor subcommands
4
+ module CLISplash
5
+
6
+ # Thor inherited class for Processes management
7
+ class WebAdmin < Thor
8
+ include Splash::WebAdmin::Controller
9
+ include Splash::Config
10
+ include Splash::Exiter
11
+ include Splash::Helpers
12
+
13
+
14
+ # Thor method : stopping Splash Webadmin
15
+ desc "stop", "Stopping Splash Webadmin Daemon"
16
+ def stop
17
+ acase = run_as_root :stopdaemon, options
18
+ splash_exit acase
19
+ end
20
+
21
+ # Thor method : getting execution status of Splashd
22
+ desc "status", "Splash WebAdmin Daemon status"
23
+ def status
24
+ acase = run_as_root :statusdaemon, options
25
+ splash_exit acase
26
+ end
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ # Thor method : getting execution status of Splash WebAdmin
35
+ long_desc <<-LONGDESC
36
+ Starting Splash Daemon\n
37
+ LONGDESC
38
+ desc "start", "Splash WebAdmin Daemon status"
39
+ def start
40
+ acase = run_as_root :startdaemon
41
+ splash_exit acase
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -1,6 +1,12 @@
1
1
  # coding: utf-8
2
+
3
+ # base Splash module
2
4
  module Splash
5
+
6
+ # Splash Commands module/namespace
3
7
  module Commands
8
+
9
+ # command execution wrapper
4
10
  class CommandWrapper
5
11
  include Splash::Templates
6
12
  include Splash::Config
@@ -16,20 +22,27 @@ module Splash
16
22
  @@registry.register(@@metric_exitcode)
17
23
  @@registry.register(@@metric_time)
18
24
 
25
+ # Constructor
26
+ # @param [String] name the name of the command
19
27
  def initialize(name)
20
28
  @config = get_config
21
- @url = "http://#{@config.prometheus_pushgateway_host}:#{@config.prometheus_pushgateway_port}"
29
+ @url = "http://#{@config.prometheus_pushgateway_host}:#{@config.prometheus_pushgateway_port}/#{@config.prometheus_pushgateway_path}"
22
30
  @name = name
23
31
  unless @config.commands.keys.include? @name.to_sym then
24
32
  splash_exit case: :not_found, more: "command #{@name} is not defined in configuration"
25
33
  end
26
34
  end
27
35
 
36
+ # wrapper for ack command ( return 0 to prometheus via notify)
28
37
  def ack
29
38
  get_logger.info "Sending ack for command : '#{@name}'"
30
39
  notify(0,0)
31
40
  end
32
41
 
42
+ # send metrics to Prometheus PushGateway
43
+ # @param [String] value numeric.to_s
44
+ # @param [String] time execution time numeric.to_s
45
+ # @return [Hash] Exiter case :quiet_exit
33
46
  def notify(value,time)
34
47
  unless verify_service host: @config.prometheus_pushgateway_host ,port: @config.prometheus_pushgateway_port then
35
48
  return { :case => :service_dependence_missing, :more => "Prometheus Notification not send."}
@@ -41,7 +54,15 @@ module Splash
41
54
  return { :case => :quiet_exit}
42
55
  end
43
56
 
44
-
57
+ # execute commands or sequence via callbacks, remote or not, notify prometheus, templatize report to backends
58
+ # the big cheese
59
+ # @param [Hash] options
60
+ # @option options [String] :session a number of session in case of Daemon Logger
61
+ # @option options [String] :hostname for remote execution (can't be use with commands with delegate_to)
62
+ # @option options [Boolean] :notify to activate prometheus notifications
63
+ # @option options [Boolean] :trace to activate execution report
64
+ # @option options [Boolean] :callback to activate sequence and callbacks executions
65
+ # @return [Hash] Exiter case
45
66
  def call_and_notify(options)
46
67
  log = get_logger
47
68
  session = (options[:session])? options[:session] : get_session
@@ -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,17 +15,33 @@ 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}"
24
+
25
+ self[:prometheus_url] = (config_from_file[:prometheus][:url])? config_from_file[:prometheus][:url] : PROMETHEUS_URL
26
+
27
+ self[:prometheus_pushgateway_path] = (config_from_file[:prometheus][:pushgateway][:path])? config_from_file[:prometheus][:pushgateway][:path] : PROMETHEUS_PUSHGATEWAY_PATH
20
28
  self[:prometheus_pushgateway_host] = (config_from_file[:prometheus][:pushgateway][:host])? config_from_file[:prometheus][:pushgateway][:host] : PROMETHEUS_PUSHGATEWAY_HOST
21
29
  self[:prometheus_pushgateway_port] = (config_from_file[:prometheus][:pushgateway][:port])? config_from_file[:prometheus][:pushgateway][:port] : PROMETHEUS_PUSHGATEWAY_PORT
22
30
  self[:daemon_process_name] = (config_from_file[:daemon][:process_name])? config_from_file[:daemon][:process_name] : DAEMON_PROCESS_NAME
23
31
  self[:daemon_logmon_scheduling] = (config_from_file[:daemon][:logmon_scheduling])? config_from_file[:daemon][:logmon_scheduling] : DAEMON_LOGMON_SCHEDULING
24
32
  self[:daemon_metrics_scheduling] = (config_from_file[:daemon][:metrics_scheduling])? config_from_file[:daemon][:metrics_scheduling] : DAEMON_METRICS_SCHEDULING
25
33
  self[:daemon_procmon_scheduling] = (config_from_file[:daemon][:procmon_scheduling])? config_from_file[:daemon][:procmon_scheduling] : DAEMON_PROCMON_SCHEDULING
34
+
35
+
36
+ self[:webadmin_port] = (config_from_file[:webadmin][:port])? config_from_file[:webadmin][:port] : WEBADMIN_PORT
37
+ self[:webadmin_ip] = (config_from_file[:webadmin][:ip])? config_from_file[:webadmin][:ip] : WEBADMIN_IP
38
+ self[:webadmin_proxy] = (config_from_file[:webadmin][:proxy])? config_from_file[:webadmin][:proxy] : WEBADMIN_PROXY
39
+ self[:webadmin_process_name] = (config_from_file[:webadmin][:process_name])? config_from_file[:webadmin][:process_name] : WEBADMIN_PROCESS_NAME
40
+ self[:webadmin_pid_file] = (config_from_file[:webadmin][:files][:pid_file])? config_from_file[:webadmin][:files][:pid_file] : WEBADMIN_PID_FILE
41
+ self[:webadmin_stdout_trace] = (config_from_file[:webadmin][:files][:stdout_trace])? config_from_file[:webadmin][:files][:stdout_trace] : WEBADMIN_STDOUT_TRACE
42
+ self[:webadmin_stderr_trace] = (config_from_file[:webadmin][:files][:stderr_trace])? config_from_file[:webadmin][:files][:stderr_trace] : WEBADMIN_STDERR_TRACE
43
+
44
+
26
45
  self[:execution_template_tokens] = EXECUTION_TEMPLATE_TOKENS_LIST
27
46
  self[:execution_template_path] = (config_from_file[:templates][:execution][:path])? config_from_file[:templates][:execution][:path] : EXECUTION_TEMPLATE
28
47
  self[:pid_path] = (config_from_file[:daemon][:paths][:pid_path])? config_from_file[:daemon][:paths][:pid_path] : DAEMON_PID_PATH
@@ -43,79 +62,190 @@ module Splash
43
62
 
44
63
  # @!group accessors on configurations Items
45
64
 
65
+ # getter for full Config Hash
66
+ # @return [Hash]
67
+ def full
68
+ return self
69
+ end
70
+
71
+ # getter for loggers Hash Config sample
72
+ # @return [Hash]
46
73
  def loggers
47
74
  return self[:loggers]
48
75
  end
49
76
 
77
+ # getter for backends Hash Config sample
78
+ # @return [Hash]
50
79
  def backends
51
80
  return self[:backends]
52
81
  end
53
82
 
83
+ # getter for transports Hash Config sample
84
+ # @return [Hash]
54
85
  def transports
55
86
  return self[:transports]
56
87
  end
57
88
 
89
+ # getter for daemon_logmon_scheduling Hash Config sample
90
+ # @return [Hash]
58
91
  def daemon_logmon_scheduling
59
92
  return self[:daemon_logmon_scheduling]
60
93
  end
61
94
 
95
+ # getter for daemon_procmon_scheduling Hash Config sample
96
+ # @return [Hash]
62
97
  def daemon_procmon_scheduling
63
98
  return self[:daemon_procmon_scheduling]
64
99
  end
65
100
 
101
+ # getter for daemon_metrics_scheduling Hash Config sample
102
+ # @return [Hash]
66
103
  def daemon_metrics_scheduling
67
104
  return self[:daemon_metrics_scheduling]
68
105
  end
69
106
 
107
+ # getter for execution_template_path Hash Config sample
108
+ # @return [String]
70
109
  def execution_template_path
71
110
  return self[:execution_template_path]
72
111
  end
112
+
113
+ # getter for execution_template_tokens Hash Config sample
114
+ # @return [Array]
73
115
  def execution_template_tokens
74
116
  return self[:execution_template_tokens]
75
117
  end
118
+
119
+
120
+ # getter for webadmin_port Hash Config sample
121
+ # @return [Fixnum]
122
+ def webadmin_port
123
+ return self[:webadmin_port]
124
+ end
125
+
126
+ # getter for webadmin_ip Hash Config sample
127
+ # @return [String]
128
+ def webadmin_ip
129
+ return self[:webadmin_ip]
130
+ end
131
+
132
+ # getter for webadmin_proxy Hash Config sample
133
+ # @return [TrueClass|FalseClass]
134
+ def webadmin_proxy
135
+ return self[:webadmin_proxy]
136
+ end
137
+
138
+ # getter for webadmin_process_name Config sample
139
+ # @return [String]
140
+ def webadmin_process_name
141
+ return self[:webadmin_process_name]
142
+ end
143
+
144
+ # getter for webadmin_full_pid_path Config sample
145
+ # @return [String]
146
+ def webadmin_full_pid_path
147
+ return "#{self[:pid_path]}/#{self[:webadmin_pid_file]}"
148
+ end
149
+
150
+ # getter for webadmin_full_stdout_trace_path Config sample
151
+ # @return [String]
152
+ def webadmin_full_stdout_trace_path
153
+ return "#{self[:trace_path]}/#{self[:webadmin_stdout_trace]}"
154
+ end
155
+
156
+ # getter for webadmin_full_stderr_trace_path Config sample
157
+ # @return [String]
158
+ def webadmin_full_stderr_trace_path
159
+ return "#{self[:trace_path]}/#{self[:webadmin_stderr_trace]}"
160
+ end
161
+
162
+
163
+
164
+
165
+ # getter for logs Hash Config sample
166
+ # @return [Hash]
76
167
  def logs
77
168
  return self[:logs]
78
169
  end
79
170
 
171
+ # getter for commands Hash Config sample
172
+ # @return [Hash]
80
173
  def commands
81
174
  return self[:commands]
82
175
  end
83
176
 
177
+ # getter for processes Hash Config sample
178
+ # @return [Hash]
84
179
  def processes
85
180
  return self[:processes]
86
181
  end
87
182
 
183
+
184
+ # getter for author Config sample
185
+ # @return [String]
88
186
  def author
89
187
  return self[:author]
90
188
  end
91
189
 
190
+ # getter for copyright Config sample
191
+ # @return [String]
92
192
  def copyright
93
193
  return self[:copyright]
94
194
  end
95
195
 
196
+ # getter for version Config sample
197
+ # @return [String]
96
198
  def version
97
199
  return self[:version]
98
200
  end
99
201
 
202
+
203
+
204
+
205
+ # getter for daemon_process_name Config sample
206
+ # @return [String]
100
207
  def daemon_process_name
101
208
  return self[:daemon_process_name]
102
209
  end
103
210
 
211
+ # getter for prometheus_pushgateway_host Config sample
212
+ # @return [String]
104
213
  def prometheus_pushgateway_host
105
214
  return self[:prometheus_pushgateway_host]
106
215
  end
216
+
217
+ # getter for prometheus_pushgateway_port Config sample
218
+ # @return [String]
107
219
  def prometheus_pushgateway_port
108
220
  return self[:prometheus_pushgateway_port]
109
221
  end
110
222
 
223
+ # getter for prometheus_pushgateway_path Config sample
224
+ # @return [String]
225
+ def prometheus_pushgateway_path
226
+ return self[:prometheus_pushgateway_path]
227
+ end
228
+
229
+ # getter for prometheus_url Config sample
230
+ # @return [String]
231
+ def prometheus_url
232
+ return self[:prometheus_url]
233
+ end
234
+
235
+ # getter for full_pid_path Config sample
236
+ # @return [String]
111
237
  def full_pid_path
112
238
  return "#{self[:pid_path]}/#{self[:pid_file]}"
113
239
  end
114
240
 
241
+ # getter for full_stdout_trace_path Config sample
242
+ # @return [String]
115
243
  def full_stdout_trace_path
116
244
  return "#{self[:trace_path]}/#{self[:stdout_trace]}"
117
245
  end
118
246
 
247
+ # getter for full_stderr_trace_path Config sample
248
+ # @return [String]
119
249
  def full_stderr_trace_path
120
250
  return "#{self[:trace_path]}/#{self[:stderr_trace]}"
121
251
  end
@@ -123,6 +253,10 @@ module Splash
123
253
  # @!endgroup
124
254
 
125
255
  private
256
+
257
+ # read config file
258
+ # @param [String] file default from CONFIG_FILE
259
+ # @return [Hash] The config global Hash from YAML
126
260
  def readconf(file = CONFIG_FILE)
127
261
  return YAML.load_file(file)[:splash]
128
262
  end
@@ -133,6 +267,7 @@ module Splash
133
267
 
134
268
 
135
269
  @@config=nil
270
+
136
271
  # factory of Configuration Class instance
137
272
  # @param [String] config_file the path of the YAML Config file
138
273
  # @return [SPlash::Config::Configuration]
@@ -140,7 +275,12 @@ module Splash
140
275
  return @@config ||= Configuration::new(config_file)
141
276
  end
142
277
 
143
-
278
+ # reset of Configuration Class instance
279
+ # @param [String] config_file the path of the YAML Config file
280
+ # @return [SPlash::Config::Configuration]
281
+ def rehash_config(config_file=CONFIG_FILE)
282
+ return @@config = Configuration::new(config_file)
283
+ end
144
284
 
145
285
 
146
286
  end