From e9f1a44724cd62b498932607149179aa1f6538e5 Mon Sep 17 00:00:00 2001 From: jowj Date: Tue, 2 Oct 2018 19:14:02 -0500 Subject: [PATCH] Make monitor function output structured data again. --- arke.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arke.py b/arke.py index cd82bd9..6aacc92 100644 --- a/arke.py +++ b/arke.py @@ -4,13 +4,18 @@ logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %I:%M:%S logger = logging.getLogger("arke") def monitor_AllTargets(monitoringtargets): + responseTable = {} for target in monitoringtargets: try: statuscode = requests.get(target).status_code logger.info(f"target: {target} statuscode: {statuscode}") + responseTable[target] = statuscode # prints the int of the status code. Find more at httpstatusrappers.com :) except requests.ConnectionError: logger.warn(f"target: {target} ERROR: Failure to connect.") + responseTable[target] = "Failed to connect." + + return responseTable monitor_AllTargets(arkevars.httpTargets)