summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-05-04 18:32:12 -0700
committerGitHub <noreply@github.com>2018-05-04 18:32:12 -0700
commite97a7707c45f30390d721d752d76fdb5d701c72d (patch)
treec1e00c7a906cf24e64c4a3b2e4dca39348962e84 /lib/oxidized
parentab106f3fa79bbe18bcb7bd24d9c2df93a3df4ed8 (diff)
parent73175e95c253471f7f06dee04f88e76c77204e6c (diff)
Merge pull request #1318 from wk/resolve-dns
Introduce resolve_dns knob (closes #599)
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/config.rb1
-rw-r--r--lib/oxidized/node.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb
index 9eb9b90..36d9d73 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