You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
524 B

import json, datetime, os
"""
basically read a log file,
if what is being read contains a WARN:
Look at timestamp, target,
if more > 1 consecutive timestamp with the same target:
send to slack
"""
results = []
with open("results.json", "r") as json_File:
for line in json_File:
results.append(json.loads(line))
for key,value in results[-1].items():
if value != 200:
errorFile = open("errors.log", "w")
errorText = key + " is down." + "\n"
errorFile.write(errorText)