Class: WatchmonkeyCli::Checkers::FtpAvailability
- Inherits:
-
WatchmonkeyCli::Checker
- Object
- WatchmonkeyCli::Checker
- WatchmonkeyCli::Checkers::FtpAvailability
- Defined in:
- lib/watchmonkey_cli/checkers/ftp_availability.rb
Constant Summary
Constants included from Helper
Instance Attribute Summary
Attributes inherited from WatchmonkeyCli::Checker
Instance Method Summary collapse
Methods inherited from WatchmonkeyCli::Checker
#_tolog, #blank_config, checker_name, checker_name=, #debug, descendants, #error, #info, inherited, #init, #initialize, #local, maxrt, maxrt=, #rsafe, #safe, #spawn_sub, #start, #stop
Methods included from Helper
#human_filesize, #human_number, #human_seconds
Constructor Details
This class inherits a constructor from WatchmonkeyCli::Checker
Instance Method Details
#check!(result, host, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/watchmonkey_cli/checkers/ftp_availability.rb', line 11 def check! result, host, opts = {} Net::FTP.open(host) do |ftp| ftp.login(opts[:user], opts[:password]) end rescue Net::FTPPermError result.error! "Invalid credentials!" rescue SocketError => e result.error! "#{e.class}: #{e.}" end |
#enqueue(host, opts = {}) ⇒ Object
6 7 8 9 |
# File 'lib/watchmonkey_cli/checkers/ftp_availability.rb', line 6 def enqueue host, opts = {} opts = {}.merge(opts) app.enqueue(self, host, opts) end |