def run_tcp_check(addresses, close=2, timer=10): logger.debug('Starting TCP Checking for addresses: {0}'.format( " ".join(addresses))) t = threading.Thread(target=tcp_check, args=[addresses, close, timer]) t.daemon = True t.start()
def run_mate_check(addresses, timer): logger.debug('Start mate checking (timer: {t}) for addresses: {a}'.format( a=" ".join(addresses), t=timer)) t = threading.Thread(target=mate_check, args=[addresses, timer]) t.daemon = True t.start()
def run_mail_success(user, password, receivers, server, port, subject, sender, append, timer): logger.debug('mail - Starting success mailer (timer: {t})'.format(t=timer)) t = threading.Thread(target=mail_success, args=[user, password, receivers, server, port, subject, sender, append, timer]) t.daemon = True t.start()
def run_curl_checker(addresses, timer=10): logger.debug( 'webcheck - Start checking (timer: {t}) for addresses: {a}'.format( a=" ".join(addresses), t=timer)) t = threading.Thread(target=curl_checker, args=[addresses, timer]) t.daemon = True t.start()
def tcp_check(addresses, close=2, timer=10): while True: for addr_port in addresses: logger.debug("tcp - Checking {0}".format(addr_port)) if ':' not in addr_port: logger.error( 'tcp - Port not specified on address: {addr}'.format( addr=addr_port)) else: try: addr = addr_port.split(':')[0] port = int(addr_port.split(':')[1]) tcp_checker(addr, port, close) except Exception as err: logger.error( "tcp - Failed to check {0} due to an error: {1}". format(addr_port, str(err))) time.sleep(timer)