summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/custodian/alerter.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/custodian/alerter.rb b/lib/custodian/alerter.rb
index 202b372..30255f4 100644
--- a/lib/custodian/alerter.rb
+++ b/lib/custodian/alerter.rb
@@ -31,11 +31,12 @@ class Alerter
# Resolve an IP address
#
def resolve_ip( target )
+ resolved = nil
begin
timeout( 4 ) do
begin
Socket.getaddrinfo(target, 'echo').each do |a|
- resolved = a[3] if ( a )
+ resolved = a[2] if ( a )
end
rescue SocketError
resolved = nil
@@ -44,6 +45,7 @@ class Alerter
rescue Timeout::Error => e
resolved = nil
end
+ resolved
end