summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-04 22:29:39 -0700
committermo khan <mo@mokhan.ca>2015-02-04 22:29:39 -0700
commitd388156cb6f13a23110a21538ca9a33e56dd0853 (patch)
tree45e7ccf19f51628f0bb67c3695c8e9d4e7654d9a
parentf00a33df86a42358d36eec46e19508ea20361892 (diff)
include hostname and ip address in event.
-rw-r--r--lib/fake_agent.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/fake_agent.rb b/lib/fake_agent.rb
index 8146582..e2449d1 100644
--- a/lib/fake_agent.rb
+++ b/lib/fake_agent.rb
@@ -1,3 +1,5 @@
+require 'socket'
+
class FakeAgent
attr_reader :id, :endpoint
@@ -49,6 +51,8 @@ class FakeAgent
data: {
fingerprint: fingerprint,
full_path: file,
+ hostname: Socket.gethostname,
+ ip_addresses: ip_addresses,
}
}
}
@@ -65,4 +69,8 @@ class FakeAgent
sha, * = result.split(' ')
sha
end
+
+ def ip_addresses
+ Socket.ip_address_list.find_all { |x| x.ipv4? }.map { |x| x.ip_address }
+ end
end