|
|
|
@ -14,8 +14,9 @@ logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %I:%M:%S
|
|
|
|
|
logger = logging.getLogger("arke")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
last_round_file = "/shared/state.log"
|
|
|
|
|
last_round_file = "/shared/state.json"
|
|
|
|
|
this_round_file = "/shared/results.json"
|
|
|
|
|
alert_file = "/shared/alerts.log"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def monitor_HttpTargets(monitoringtargets):
|
|
|
|
@ -110,16 +111,13 @@ while is_on:
|
|
|
|
|
# queue up an alert if stateChanged = True
|
|
|
|
|
results = []
|
|
|
|
|
with open(this_round_file, "r+", encoding="utf-8") as json_File:
|
|
|
|
|
pdb.set_trace()
|
|
|
|
|
json_data = json.load(json_File)
|
|
|
|
|
for item in json_data:
|
|
|
|
|
results.append(item)
|
|
|
|
|
for item in results:
|
|
|
|
|
for key, value in item.items():
|
|
|
|
|
if stateChanged is True:
|
|
|
|
|
errorFile = open("/shared/alerts.log", "a+")
|
|
|
|
|
errorText = key + " returned with status " + str(value) + "\n"
|
|
|
|
|
errorFile.write(errorText)
|
|
|
|
|
for key, value in json_data.items():
|
|
|
|
|
for key, value in value.items():
|
|
|
|
|
if stateChanged is True:
|
|
|
|
|
errorFile = open(alert_file, "a+")
|
|
|
|
|
errorText = str(key) + " " + str(value) + "\n"
|
|
|
|
|
errorFile.write(errorText)
|
|
|
|
|
|
|
|
|
|
# Copy current results to state.log file for next iteration
|
|
|
|
|
with open(last_round_file, "a+") as json_File:
|
|
|
|
|