parent
e35c7a5454
commit
40f21fc7e0
@ -1,15 +1,20 @@
|
|||||||
import requests, arkevars, json
|
import requests, arkevars, json, logging
|
||||||
|
|
||||||
|
FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s"
|
||||||
|
logging.basicConfig(format=FORMAT)
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
logger = logging.getLogger("arke")
|
||||||
|
|
||||||
def gather_JsonData(monitoringtargets):
|
def gather_JsonData(monitoringtargets):
|
||||||
responseTable = {}
|
responseTable = {}
|
||||||
for target in monitoringtargets:
|
for target in monitoringtargets:
|
||||||
try:
|
try:
|
||||||
statuscode = requests.get(target).status_code
|
statuscode = requests.get(target).status_code
|
||||||
responseTable[target] = statuscode
|
logger.info(f"target: {target} statuscode: {statuscode}")
|
||||||
# prints the int of the status code. Find more at httpstatusrappers.com :)
|
# prints the int of the status code. Find more at httpstatusrappers.com :)
|
||||||
|
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
responseTable[target] = "Failed to connect."
|
logger.info(f"target: {target} ERROR: Failure to connect.")
|
||||||
|
|
||||||
return responseTable
|
return responseTable
|
||||||
|
|
||||||
|
Loading…
Reference in new issue