From a9996e8115bafd9837672c26dc9b76cbf3696840 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:08:22 +0100 Subject: Adds optional debug output when loading hosts (resolving DNS) --- lib/oxidized/node.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index d50317f..c847416 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -9,6 +9,9 @@ module Oxidized attr_accessor :running, :user, :msg, :from, :stats, :retry alias :running? :running def initialize opt + if CFG.debug == true or opt[:debug] == true + puts 'resolving DNS for %s...' % opt[:name] + end @name = opt[:name] @ip = IPAddr.new(opt[:ip]).to_s rescue nil @ip ||= Resolv.new.getaddress @name -- cgit v1.2.1 From f04ada741166c7c2cd5f9eee29a89127fab1f328 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:30:44 +0100 Subject: Log crashes on node name instead of ip to ease troubleshooting --- lib/oxidized/node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index c847416..974b2d1 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -70,7 +70,7 @@ module Oxidized Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message]) return false rescue => err - file = Oxidized::Config::Crash + '.' + self.ip.to_s + file = Oxidized::Config::Crash + '.' + opt[:name] open file, 'w' do |fh| fh.puts Time.now.utc fh.puts err.message + ' [' + err.class.to_s + ']' -- cgit v1.2.1 From dc5f7285c87dc45763a24636a95c4081552356de Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 09:46:41 +0100 Subject: Revert crash logging on fqdn - seems to crash oxidized... --- lib/oxidized/node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 974b2d1..c847416 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -70,7 +70,7 @@ module Oxidized Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message]) return false rescue => err - file = Oxidized::Config::Crash + '.' + opt[:name] + file = Oxidized::Config::Crash + '.' + self.ip.to_s open file, 'w' do |fh| fh.puts Time.now.utc fh.puts err.message + ' [' + err.class.to_s + ']' -- cgit v1.2.1 From 201c02551d96a070f8d55936aba350f772649465 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 18:19:36 +0000 Subject: expose git repo name and commit oid in hook mechanism and environment variables --- lib/oxidized/node.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/oxidized/node.rb') diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index c847416..df5b830 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -5,7 +5,7 @@ module Oxidized class MethodNotFound < OxidizedError; end class ModelNotFound < OxidizedError; end class Node - attr_reader :name, :ip, :model, :input, :output, :group, :auth, :prompt, :vars, :last + attr_reader :name, :ip, :model, :input, :output, :group, :auth, :prompt, :vars, :last, :repo attr_accessor :running, :user, :msg, :from, :stats, :retry alias :running? :running def initialize opt @@ -24,6 +24,7 @@ module Oxidized @vars = opt[:vars] @stats = Stats.new @retry = 0 + @repo = CFG.output.git.repo # model instance needs to access node instance @model.node = self -- cgit v1.2.1