summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiyev@gmail.com>2016-06-02 21:24:48 +0200
committerElvin Efendi <elvin.efendiyev@gmail.com>2016-06-02 22:14:09 +0200
commit71d9bdc6a529d187d58a855208341409aa872289 (patch)
tree15b102314c4090d9ecdcd518e3c5c902027bfeaa
parentcf4ab7752cd7c6141f2da0a7491c9f1842c88f09 (diff)
more debug stratements
-rw-r--r--lib/oxidized/core.rb1
-rw-r--r--lib/oxidized/input/ssh.rb1
-rw-r--r--lib/oxidized/job.rb2
-rw-r--r--lib/oxidized/node.rb3
-rw-r--r--lib/oxidized/nodes.rb3
-rw-r--r--lib/oxidized/worker.rb4
6 files changed, 12 insertions, 2 deletions
diff --git a/lib/oxidized/core.rb b/lib/oxidized/core.rb
index d57c5cb..e007c9d 100644
--- a/lib/oxidized/core.rb
+++ b/lib/oxidized/core.rb
@@ -31,6 +31,7 @@ module Oxidized
private
def run
+ Oxidized.logger.debug "lib/oxidized/core.rb: Starting the worker..."
while true
@worker.work
sleep Config::Sleep
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index aa44b37..db39a7e 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -37,6 +37,7 @@ module Oxidized
ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex)
ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption)
+ Oxidized.logger.debug "lib/oxidized/input/ssh.rb: Connecting to #{@node.name}"
@ssh = Net::SSH.start(@node.ip, @node.auth[:username], ssh_opts)
unless @exec
shell_open @ssh
diff --git a/lib/oxidized/job.rb b/lib/oxidized/job.rb
index 0a4a24b..924cd44 100644
--- a/lib/oxidized/job.rb
+++ b/lib/oxidized/job.rb
@@ -5,9 +5,11 @@ module Oxidized
@node = node
@start = Time.now.utc
super do
+ Oxidized.logger.debug "lib/oxidized/job.rb: Starting fetching process for #{@node.name} at #{Time.now.utc}"
@status, @config = @node.run
@end = Time.now.utc
@time = @end - @start
+ Oxidized.logger.debug "lib/oxidized/job.rb: Config fetched for #{@node.name} at #{@end}"
end
end
end
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 35bcad9..cc1e406 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -38,9 +38,11 @@ module Oxidized
next unless @model.cfg[cfg_name] and not @model.cfg[cfg_name].empty?
@model.input = input = input.new
if config=run_input(input)
+ Oxidized.logger.debug "lib/oxidized/node.rb: #{input.class.name} ran for #{name} successfully"
status = :success
break
else
+ Oxidized.logger.debug "lib/oxidized/node.rb: #{input.class.name} failed for #{name}"
status = :no_connection
end
end
@@ -165,6 +167,7 @@ module Oxidized
def resolve_model opt
model = (opt[:model] or Oxidized.config.model)
if not Oxidized.mgr.model[model]
+ Oxidized.logger.debug "lib/oxidized/node.rb: Loading model #{model.inspect}"
Oxidized.mgr.add_model model or raise ModelNotFound, "#{model} not found for node #{ip}"
end
Oxidized.mgr.model[model].new
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb
index 61d2d44..cd67007 100644
--- a/lib/oxidized/nodes.rb
+++ b/lib/oxidized/nodes.rb
@@ -11,6 +11,7 @@ module Oxidized
new = []
@source = Oxidized.config.source.default
Oxidized.mgr.add_source @source
+ Oxidized.logger.info "lib/oxidized/nodes.rb: Loading nodes"
Oxidized.mgr.source[@source].new.load.each do |node|
# we want to load specific node(s), not all of them
next unless node_want? node_want, node
@@ -24,7 +25,7 @@ module Oxidized
end
end
size == 0 ? replace(new) : update_nodes(new)
- Oxidized.logger.info "Loaded #{size} nodes"
+ Oxidized.logger.info "lib/oxidized/nodes.rb: Loaded #{size} nodes"
end
end
diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb
index 48852ef..7aec42a 100644
--- a/lib/oxidized/worker.rb
+++ b/lib/oxidized/worker.rb
@@ -14,7 +14,7 @@ module Oxidized
ended.each { |job| process job }
@jobs.work
while @jobs.size < @jobs.want
- Oxidized.logger.debug "Jobs #{@jobs.size}, Want: #{@jobs.want}"
+ Oxidized.logger.debug "lib/oxidized/worker.rb: Jobs #{@jobs.size}, Want: #{@jobs.want}"
# ask for next node in queue non destructive way
nextnode = @nodes.first
unless nextnode.last.nil?
@@ -26,7 +26,9 @@ module Oxidized
node = @nodes.get
node.running? ? next : node.running = true
@jobs.push Job.new node
+ Oxidized.logger.debug "lib/oxidized/worker.rb: Added #{node.name} to the job queue"
end
+ Oxidized.logger.debug "lib/oxidized/worker.rb: #{@jobs.size} jobs running in parallel"
end
def process job