diff options
-rw-r--r-- | lib/oxidized/input/tftp.rb (renamed from lib/oxidized/input/tftp) | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/oxidized/input/tftp b/lib/oxidized/input/tftp.rb index cac8f2d..2a6a088 100644 --- a/lib/oxidized/input/tftp +++ b/lib/oxidized/input/tftp.rb @@ -1,5 +1,4 @@ module Oxidized - require 'net/tftp' require 'timeout' require 'stringio' require_relative 'cli' @@ -19,6 +18,11 @@ module Oxidized # TFTP utilizes UDP, there is not a connection. We simply specify an IP and send/receive data. def connect node + begin + require 'net/tftp' + rescue LoadError + raise OxidizedError, 'net/tftp not found: sudo gem install net-tftp' + end @node = node @node.model.cfg['tftp'].each { |cb| instance_exec(&cb) } @@ -49,6 +53,7 @@ module Oxidized def disconnect # TFTP uses UDP, there is no connection to close + #rescue Errno::ECONNRESET, IOError ensure @log.close if Oxidized.config.input.debug? end |