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.

22 lines
827 B

import requests, arkevars, json, logging
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %I:%M:%S %p',level=logging.INFO,filename='example.log')
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)