diff options
author | Wild Kat <wk@futureinquestion.net> | 2018-04-27 19:05:59 +0200 |
---|---|---|
committer | Wild Kat <wk@futureinquestion.net> | 2018-04-27 19:05:59 +0200 |
commit | e2e01f0db85c99aba0b49671701f30adfeaf46fd (patch) | |
tree | 11054af6b29c4bed17b7573cfc9c1817d08fb1ab /lib | |
parent | 71a257f6d06dc963932fe25412b840a0688e1e76 (diff) | |
parent | 50b3bc843d115351d109399a9ef453e3790b01fd (diff) |
Merge remote-tracking branch 'upstream/no-resolve' into resolve-dns
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/config.rb | 1 | ||||
-rw-r--r-- | lib/oxidized/node.rb | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb index 9eb9b90..0a8fdfd 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.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 diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 27bd9a5..4105da0 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -15,7 +15,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 |