From e2899b55638101ddf97aeab919a9f064daf05451 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sat, 4 Feb 2017 11:49:31 +0200 Subject: give option to stop resolving name to IP With ssh proxy you might want to have far-end resolve --- lib/oxidized/config.rb | 1 + lib/oxidized/node.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb index b6b5c40..c97fa2f 100644 --- a/lib/oxidized/config.rb +++ b/lib/oxidized/config.rb @@ -20,6 +20,7 @@ module Oxidized asetus.default.username = 'username' asetus.default.password = 'password' asetus.default.model = 'junos' + asetus.deefault.resolve_dns = true # if false, don't resolve DNS to IP asetus.default.interval = 3600 asetus.default.use_syslog = false asetus.default.debug = false diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 6f89b56..7201a73 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -14,7 +14,8 @@ module Oxidized ip_addr, _ = opt[:ip].to_s.split("/") Oxidized.logger.debug 'IPADDR %s' % ip_addr.to_s @name = opt[:name] - @ip = IPAddr.new(ip_addr).to_s rescue nil + @ip = @name unless Oxidized.config.resolve_dns? + @ip ||= IPAddr.new(ip_addr).to_s rescue nil @ip ||= Resolv.new.getaddress @name @group = opt[:group] @input = resolve_input opt -- cgit v1.2.1 From 50b3bc843d115351d109399a9ef453e3790b01fd Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sat, 4 Feb 2017 12:00:03 +0200 Subject: typo fix --- lib/oxidized/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb index c97fa2f..a92cea6 100644 --- a/lib/oxidized/config.rb +++ b/lib/oxidized/config.rb @@ -20,7 +20,7 @@ module Oxidized asetus.default.username = 'username' asetus.default.password = 'password' asetus.default.model = 'junos' - asetus.deefault.resolve_dns = true # if false, don't resolve DNS to IP + asetus.default.resolve_dns = true # if false, don't resolve DNS to IP asetus.default.interval = 3600 asetus.default.use_syslog = false asetus.default.debug = false -- cgit v1.2.1