# Path: Database/db_helpers.py
# class server_stats(object):
# class email_log(object):
# class monitor_list(object):
#     class tcp():
#     class host():
#     class url():
#     def failures_in_x_minutes_ago(last_x_minutes_of_failures):
#     def log_email_sent(to_list):
#     def email_sent_x_minutes_ago():
#     def get_server_list():
#     def get_time_from_last_failure():
#     def log_service_down(server_logger_obj):
#     def remove_server_from_monitor_list(index_to_remove):
#         def __init__(self):
#         def create_server(ip_address, port, note=None):
#         def __init__(self):
#         def create_server(ip_address, note=None):
#         def __init__(self):
#         def create_server(web_url, note=None):
# 
# Path: Alerters/email_controller.py
# class gmailSettings():
# class SettingsHelper(gmailSettings):
# class send_gmail(object, SettingsHelper):
#     USERNAME = ""
#     SEND_ALERT_TO = []  # Must be a list
#     SETTINGS_FILE_PATH = "email_settings.json"
#     KEYRING_APP_ID = 'NetworkMonitor_email'
#     def loadSettings(cls):
#     def saveSettings(cls):
#     def __init__(self):
#     def test_login(self):
#     def send(self, subject, text):
#     def convert_to_list_to_csv(self):
#     def configure(self):
#     def clear_password_store(self):


from datetime import datetime
from Database import db_helpers
from Alerters import email_controller
import logging
        return host_name, port

    @staticmethod
    def generate_fail_table(fail_list_in, monitor_list_in):
        w_ts = 25
        w_hn = 50
        w_p = 8
        w_sr = 10
        w_no = 25
        width = (w_ts + w_hn + w_p + w_sr + w_no + 16)

        fail_list_txt = ["Servers:",
                         '\n' + '-' * width + '\n',
                         "| {0} | {1} | {2} | {3} | {4} |".format("Time Stamp".ljust(w_ts), "Hostname".ljust(w_hn),
                                                                  "Port".ljust(w_p),
                                                                  "Service".ljust(w_sr), "Note".ljust(w_no)),
                         '\n' + '-' * width + '\n']

        #
        # Beginning of item in list
        for fail_event in fail_list_in:
            host_name_fail_event = ''
            port = ''

            try:
                # Try to parse port from hostname address
                # (should still work even if host is removed from monitor_list)
                if fail_event[3] != 'url':
                    host_name_fail_event = str(fail_event[2]).split(':')[0]  # 127.0.0.1:80
                    port = str(fail_event[2]).split(':')[1]

# Path: Database/db_helpers.py
# class server_stats(object):
# class email_log(object):
# class monitor_list(object):
#     class tcp():
#     class host():
#     class url():
#     def failures_in_x_minutes_ago(last_x_minutes_of_failures):
#     def log_email_sent(to_list):
#     def email_sent_x_minutes_ago():
#     def get_server_list():
#     def get_time_from_last_failure():
#     def log_service_down(server_logger_obj):
#     def remove_server_from_monitor_list(index_to_remove):
#         def __init__(self):
#         def create_server(ip_address, port, note=None):
#         def __init__(self):
#         def create_server(ip_address, note=None):
#         def __init__(self):
#         def create_server(web_url, note=None):
# 
# Path: Alerters/email_controller.py
# class gmailSettings():
# class SettingsHelper(gmailSettings):
# class send_gmail(object, SettingsHelper):
#     USERNAME = ""
#     SEND_ALERT_TO = []  # Must be a list
#     SETTINGS_FILE_PATH = "email_settings.json"
#     KEYRING_APP_ID = 'NetworkMonitor_email'
#     def loadSettings(cls):
#     def saveSettings(cls):
#     def __init__(self):
#     def test_login(self):
#     def send(self, subject, text):
#     def convert_to_list_to_csv(self):
#     def configure(self):
#     def clear_password_store(self):


# Path: Alerters/email_alerts.py
from datetime import datetime
from Database import db_helpers
from Alerters import email_controller
import logging

        return host_name, port

    @staticmethod
    def generate_fail_table(fail_list_in, monitor_list_in):
        w_ts = 25
        w_hn = 50
        w_p = 8
        w_sr = 10
        w_no = 25
        width = (w_ts + w_hn + w_p + w_sr + w_no + 16)

        fail_list_txt = ["Servers:",
                         '\n' + '-' * width + '\n',
                         "| {0} | {1} | {2} | {3} | {4} |".format("Time Stamp".ljust(w_ts), "Hostname".ljust(w_hn),
                                                                  "Port".ljust(w_p),
                                                                  "Service".ljust(w_sr), "Note".ljust(w_no)),
                         '\n' + '-' * width + '\n']

        #
        # Beginning of item in list
        for fail_event in fail_list_in:
            host_name_fail_event = ''
            port = ''

            try:
                # Try to parse port from hostname address
                # (should still work even if host is removed from monitor_list)
                if fail_event[3] != 'url':
                    host_name_fail_event = str(fail_event[2]).split(':')[0]  # 127.0.0.1:80
                    port = str(fail_event[2]).split(':')[1]

                if fail_event[3] == 'url':