summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2015-02-21 15:53:46 +0200
committerSaku Ytti <saku@ytti.fi>2015-02-21 15:56:28 +0200
commit61c128c95ffbcdff0e379d8b005c287db54c5cc3 (patch)
tree80e2cff2ea41612dc0938751226b3d289a40a708 /lib/oxidized
parent1a9a8143d89bcdf8ac336edd1c9d262f68055306 (diff)
allow setting IP from source
sql/csv can now set IP as well as name, useful if you don't have FQDN. If IP is given, then we don't try to resolve name. closes #78
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/node.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 6bc2b0f..2d41600 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -10,7 +10,8 @@ module Oxidized
alias :running? :running
def initialize opt
@name = opt[:name]
- @ip = Resolv.getaddress @name
+ @ip = IPAddr.new(opt[:ip]).to_s rescue nil
+ @ip ||= Resolv.getaddress @name
@group = opt[:group]
@input = resolve_input opt
@output = resolve_output opt