Add healthy text; remove new lines to make file and stateFile match.

master
jowj 4 years ago
parent acd81c9c2b
commit cb9dae54c9

@ -37,6 +37,8 @@ def monitor_DomainExpiry(targets):
try: try:
if expire_year - current_year <= 1: if expire_year - current_year <= 1:
responseTable[domain] = "Domain expiring in < 1 year, please rectify." responseTable[domain] = "Domain expiring in < 1 year, please rectify."
else:
responseTable[domain] = "Domain is healthy."
except: except:
responseTable[domain] = "Failed to query domain info" responseTable[domain] = "Failed to query domain info"
@ -54,6 +56,8 @@ def monitor_TlsExpiry(targets):
try: try:
if expiration - current_year <= 1: if expiration - current_year <= 1:
responseTable[site] = "TLS expiring in < 30 days, please rectify." responseTable[site] = "TLS expiring in < 30 days, please rectify."
else:
responseTable[site] = "cert is healthy."
except: except:
responseTable[site] = "Failed to query cert info" responseTable[site] = "Failed to query cert info"
@ -81,11 +85,8 @@ while is_on:
# write new results to file # write new results to file
file = open("/shared/results.json", "a+") file = open("/shared/results.json", "a+")
file.write(json_string) file.write(json_string)
file.write("\n")
file.write(cert_json) file.write(cert_json)
file.write("\n")
file.write(domain_json) file.write(domain_json)
file.write("\n")
file.close() file.close()
# track state # track state
@ -93,7 +94,7 @@ while is_on:
stateFile = open("/shared/state.log", "r") stateFile = open("/shared/state.log", "r")
oldData = stateFile.read() oldData = stateFile.read()
if oldData != json_string: if oldData != file.read():
stateChanged = True stateChanged = True
else: else:
stateChanged = False stateChanged = False

Loading…
Cancel
Save