def ftp(config, host):
"""
Check a hosts FTP service
:param config: dictionary containing settings
config['vars']['ftp_timeout']: The timeout in seconds to wait for the
ftp connection to complete by
:param host: The host to connect to over FTP
:return: 3-tuple of (success, name, message)
success: Boolean value indicating if there is a problem or not
name: DNS name
message: String describing the status
"""
name = host
try:
ftp_conn = FTP(host=host,
timeout=config['vars']['ftp_timeout'])
except Exception as e:
return False, name, "Exception %s %s" % (e.__class__, e)
welcome = ftp_conn.getwelcome()
ftp_conn.quit()
return True, name, "FTP ok %s" % welcome
评论列表
文章目录