# Path: Database/db_controller.py
# class db_settings():
# class SettingsHelper(db_settings):
# class db_access(SettingsHelper, object):
# class db_helper(db_access):
#     USERNAME = 'postgres'
#     DB_HOST = '127.0.0.1'
#     PORT = 5432
#     DATABASE = 'network_monitor'
#     SETTINGS_FILE_PATH = "database_settings.json"
#     KEYRING_APP_ID = 'NetworkMonitor_db'
#         DB_HOST = raw_input('({0})>'.format(self.DB_HOST))
#     def loadSettings(cls):
#     def saveSettings(cls):
#     def __init__(self):
#     def open_connection(self):
#     def close_connection(connection, cursor):
#     def __init__(self):
#     def __create_database(self):
#     def __create_tables(self):
#     def test_db_setup(self):
#     def configure(self):
#     def clear_password_store(self):
# 
# 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: Monitors/network.py
# class MonitorHTTP():
# class MonitorTCP():
# class MonitorHost():
#     def __init__(self, url, timeout):
#     def run_test(self):
#     def describe(self):
#     def __init__(self, host, port, timeout):
#     def run_test(self):
#     def describe(self):
#     def get_params(self):
#     def __init__(self, host, timeout):
#     def run_test(self):
#     def describe(self):
# 
# Path: Database/db_monitor_list.py
# def check_for_valid_service_type():
# def get_print_server_list():
# def config_monitor_list():
# 
# 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
# class email_actions():
#     def __init__(self):
#     def send_alert(server_info_object):
#     def parse_url_info(url_in):
#     def generate_fail_table(fail_list_in, monitor_list_in):
#     def generate_report():


import sys
import os
import logging
import argparse
from time import sleep
from Database import db_controller
from Database import db_helpers
from Monitors import network
from Database import db_monitor_list
from Alerters import email_controller
from Alerters import email_alerts
                logging.info('E-mail timeout still cooling off')

            self.sleep()


class server_logger(modes):
    """ self.variable same as monitor_list columns"""

    def __init__(self, monitor_row, sleep_delay, alert_timeout, host_timeout):
        super(server_logger, self).__init__(sleep_delay, alert_timeout, host_timeout)
        self.sl_host = monitor_row[1]
        self.sl_port = monitor_row[2]
        self.sl_service_type = monitor_row[3]
        self.sl_note = monitor_row[4]

    def check_server_status(self):
        """ Picks either TCP, Ping host, or check web, depending on args """

        up_down_flag = False

        if self.sl_service_type == 'url':
            logging.debug("Checking URL: " + str(self.sl_host))
            up_down_flag = network.MonitorHTTP(url=self.sl_host, timeout=self.host_timeout).run_test()

        if self.sl_service_type == 'host':
            logging.debug("Checking host: " + str(self.sl_host))
            up_down_flag = network.MonitorHost(host=self.sl_host, timeout=self.host_timeout).run_test()

        if self.sl_service_type == 'tcp':
            logging.debug("Checking TCP Service: " + str(self.sl_host) + ' port: ' + str(self.sl_port))

# Path: Database/db_controller.py
# class db_settings():
# class SettingsHelper(db_settings):
# class db_access(SettingsHelper, object):
# class db_helper(db_access):
#     USERNAME = 'postgres'
#     DB_HOST = '127.0.0.1'
#     PORT = 5432
#     DATABASE = 'network_monitor'
#     SETTINGS_FILE_PATH = "database_settings.json"
#     KEYRING_APP_ID = 'NetworkMonitor_db'
#         DB_HOST = raw_input('({0})>'.format(self.DB_HOST))
#     def loadSettings(cls):
#     def saveSettings(cls):
#     def __init__(self):
#     def open_connection(self):
#     def close_connection(connection, cursor):
#     def __init__(self):
#     def __create_database(self):
#     def __create_tables(self):
#     def test_db_setup(self):
#     def configure(self):
#     def clear_password_store(self):
# 
# 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: Monitors/network.py
# class MonitorHTTP():
# class MonitorTCP():
# class MonitorHost():
#     def __init__(self, url, timeout):
#     def run_test(self):
#     def describe(self):
#     def __init__(self, host, port, timeout):
#     def run_test(self):
#     def describe(self):
#     def get_params(self):
#     def __init__(self, host, timeout):
#     def run_test(self):
#     def describe(self):
# 
# Path: Database/db_monitor_list.py
# def check_for_valid_service_type():
# def get_print_server_list():
# def config_monitor_list():
# 
# 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
# class email_actions():
#     def __init__(self):
#     def send_alert(server_info_object):
#     def parse_url_info(url_in):
#     def generate_fail_table(fail_list_in, monitor_list_in):
#     def generate_report():


# Path: Network_Monitor.py
import sys
import os
import logging
import argparse
from time import sleep
from Database import db_controller
from Database import db_helpers
from Monitors import network
from Database import db_monitor_list
from Alerters import email_controller
from Alerters import email_alerts

                logging.info('E-mail timeout still cooling off')

            self.sleep()


class server_logger(modes):
    """ self.variable same as monitor_list columns"""

    def __init__(self, monitor_row, sleep_delay, alert_timeout, host_timeout):
        super(server_logger, self).__init__(sleep_delay, alert_timeout, host_timeout)
        self.sl_host = monitor_row[1]
        self.sl_port = monitor_row[2]
        self.sl_service_type = monitor_row[3]
        self.sl_note = monitor_row[4]

    def check_server_status(self):
        """ Picks either TCP, Ping host, or check web, depending on args """

        up_down_flag = False

        if self.sl_service_type == 'url':
            logging.debug("Checking URL: " + str(self.sl_host))
            up_down_flag = network.MonitorHTTP(url=self.sl_host, timeout=self.host_timeout).run_test()

        if self.sl_service_type == 'host':
            logging.debug("Checking host: " + str(self.sl_host))
            up_down_flag = network.MonitorHost(host=self.sl_host, timeout=self.host_timeout).run_test()

        if self.sl_service_type == 'tcp':
            logging.debug("Checking TCP Service: " + str(self.sl_host) + ' port: ' + str(self.sl_port))

            up_down_flag = network.MonitorTCP(host=self.sl_host, port=str(self.sl_port),