lib/scout/streamer_daemon.rb in scout-5.8.8 vs lib/scout/streamer_daemon.rb in scout-5.8.9
- old
+ new
@@ -9,21 +9,23 @@
daemon_spawn_options = {:log_file => streamer_log_file,
:pid_file => streamer_pid_file,
:sync_log => true,
:working_dir => File.dirname(history_file)}
- # streamer command might look like: start,A0000000000123,a,b,c,1,3
+ # streamer command might look like: start,A0000000000123,a,b,c,1,3,cpu,memory
tokens = streamer_command.split(",")
tokens.shift # gets rid of the "start"
streaming_key = tokens.shift
p_app_id = tokens.shift
p_key = tokens.shift
p_secret = tokens.shift
- plugin_ids = tokens.map(&:to_i)
+ numerical_tokens = tokens.select { |token| token =~ /\A\d+\Z/ }
+ system_metric_collectors = (tokens - numerical_tokens).map(&:to_sym)
+ plugin_ids = numerical_tokens.map(&:to_i)
# we use STDOUT for the logger because daemon_spawn directs STDOUT to a log file
- streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,http_proxy,Logger.new(STDOUT)]
+ streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,system_metric_collectors,hostname,http_proxy,Logger.new(STDOUT)]
if File.exists?(streamer_pid_file)
Scout::StreamerDaemon.restart(daemon_spawn_options, streamer_args)
else
Scout::StreamerDaemon.start(daemon_spawn_options, streamer_args)
end
@@ -43,11 +45,11 @@
end
# this method is called by DaemonSpawn's class start method.
def start(streamer_args)
- history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,http_proxy,log = streamer_args
- @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, hostname, http_proxy, log)
+ history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,system_metric_collectors,hostname,http_proxy,log = streamer_args
+ @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, system_metric_collectors, hostname, http_proxy, log)
end
# this method is called by DaemonSpawn's class stop method.
def stop
Scout::Streamer.continue_streaming = false