diff --git a/syslog_monitoring/Alarm/__init__.py b/syslog_monitoring/Alarm/__init__.py index c4b970e..6d96465 100644 --- a/syslog_monitoring/Alarm/__init__.py +++ b/syslog_monitoring/Alarm/__init__.py @@ -35,21 +35,24 @@ scheduler.configure(executors=executors, job_defaults=job_defaults) -NtpClocksUnsynchronized = {} interval, threshold, bdds_servers = get_ntp_config_data() alm_hostname = get_alarm_host_name() def set_or_clear_alarm_ntp_clock_unsynchronized(case, source, target): + from .alarm_management import ( + key_pair, + NTPCLOCKSUNSYNCHRONIZED + ) key = "{0}_{1}".format(source, target) if case.lower() == "set": - if key in NtpClocksUnsynchronized.keys(): + if key in key_pair[NTPCLOCKSUNSYNCHRONIZED].keys(): return None, None - NtpClocksUnsynchronized.update({key: {}}) + key_pair[NTPCLOCKSUNSYNCHRONIZED].update({key: {}}) return "set", key elif case.lower() == "clear": - if key in NtpClocksUnsynchronized.keys(): - del NtpClocksUnsynchronized[key] + if key in key_pair[NTPCLOCKSUNSYNCHRONIZED].keys(): + del key_pair[NTPCLOCKSUNSYNCHRONIZED][key] return "clear", key return None, None return None, None diff --git a/syslog_monitoring/Alarm/alarm_management.py b/syslog_monitoring/Alarm/alarm_management.py index 61eff80..8b89990 100644 --- a/syslog_monitoring/Alarm/alarm_management.py +++ b/syslog_monitoring/Alarm/alarm_management.py @@ -45,6 +45,8 @@ STORAGEREADONLY = "StorageReadOnly" ZONETRANSFERFAILED = "ZoneTransferFailed" TCPCONNECTIONLIMITEXCEEDED = "TcpConnectionLimitExceeded" +TESTQUERYFAILED = "TestQueryFailed" +NTPCLOCKSUNSYNCHRONIZED = "NtpClocksUnsynchronized" key_pair = { LOADCONFIGURATIONFAILED: { @@ -60,6 +62,10 @@ ZONETRANSFERFAILED: { }, TCPCONNECTIONLIMITEXCEEDED: { + }, + TESTQUERYFAILED: { + }, + NTPCLOCKSUNSYNCHRONIZED: { } } diff --git a/syslog_monitoring/DNSHealthCheck/__init__.py b/syslog_monitoring/DNSHealthCheck/__init__.py index 64ef0ce..8a9e0d0 100644 --- a/syslog_monitoring/DNSHealthCheck/__init__.py +++ b/syslog_monitoring/DNSHealthCheck/__init__.py @@ -34,9 +34,6 @@ scheduler = BackgroundScheduler() scheduler.configure(executors=executors, job_defaults=job_defaults) -TestQueryFailed = { - -} class ExecutorManager(object): @@ -101,15 +98,19 @@ def query_dns(): def set_or_clear_alarm_test_query_failed(case, source, target): + from Alarm.alarm_management import ( + key_pair, + TESTQUERYFAILED + ) key = "{0}_{1}".format(source, target) if case.lower() == "set": - if key in TestQueryFailed.keys(): + if key in key_pair[TESTQUERYFAILED].keys(): return None, None - TestQueryFailed.update({key:{}}) + key_pair[TESTQUERYFAILED].update({key:{}}) return "set", key elif case.lower() == "clear": - if key in TestQueryFailed.keys(): - del TestQueryFailed[key] + if key in key_pair[TESTQUERYFAILED].keys(): + del key_pair[TESTQUERYFAILED][key] return "clear", key return None, None return None, None