lib/splash/controller.rb in prometheus-splash-0.0.2 vs lib/splash/controller.rb in prometheus-splash-0.0.3

- old
+ new

@@ -3,10 +3,11 @@ module LogsMonitor module DaemonController include Splash::Constants include Splash::Helpers include Splash::Config + include Splash::Orchestrator def startdaemon(options = {}) config = get_config unless verify_service host: config.prometheus_pushgateway_host ,port: config.prometheus_pushgateway_port then $stderr.puts "Prometheus PushGateway Service is not running," @@ -15,24 +16,12 @@ end unless File::exist? config.full_pid_path then res = daemonize :description => config.daemon_process_name, :pid_file => config.full_pid_path, - :daemon_user => config.daemon_user, - :daemon_group => config.daemon_group, :stdout_trace => config.full_stdout_trace_path, :stderr_trace => config.full_stderr_trace_path do - result = LogScanner::new - while true - begin - sleep 5 - puts "Notify" - result.analyse - result.notify - rescue Errno::ECONNREFUSED - $stderr.puts "PushGateway seems to be done, please start it." - end - end + Scheduler::new end if res == 0 then pid = `cat #{config.full_pid_path}`.to_i puts "Splash Daemon Started, with PID : #{pid}" else