From cb9dae54c9ca896dfab8d2a5125b89120bec706f Mon Sep 17 00:00:00 2001 From: jowj Date: Thu, 23 Jan 2020 14:41:07 -0600 Subject: [PATCH] Add healthy text; remove new lines to make file and stateFile match. --- arke.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arke.py b/arke.py index bbd9ba0..30516f1 100644 --- a/arke.py +++ b/arke.py @@ -37,6 +37,8 @@ def monitor_DomainExpiry(targets): try: if expire_year - current_year <= 1: responseTable[domain] = "Domain expiring in < 1 year, please rectify." + else: + responseTable[domain] = "Domain is healthy." except: responseTable[domain] = "Failed to query domain info" @@ -54,6 +56,8 @@ def monitor_TlsExpiry(targets): try: if expiration - current_year <= 1: responseTable[site] = "TLS expiring in < 30 days, please rectify." + else: + responseTable[site] = "cert is healthy." except: responseTable[site] = "Failed to query cert info" @@ -81,11 +85,8 @@ while is_on: # write new results to file file = open("/shared/results.json", "a+") file.write(json_string) - file.write("\n") file.write(cert_json) - file.write("\n") file.write(domain_json) - file.write("\n") file.close() # track state @@ -93,7 +94,7 @@ while is_on: stateFile = open("/shared/state.log", "r") oldData = stateFile.read() - if oldData != json_string: + if oldData != file.read(): stateChanged = True else: stateChanged = False