Add timeout to dashboard, show offline status if node times out for web api

This commit is contained in:
KemoNine 2020-08-22 17:49:57 -04:00
parent 9e2f369ad4
commit de8b52b899

View file

@ -50,6 +50,7 @@ def getMonit():
cf = json.loads(f.read())
for site in cf:
try:
s = cf[site]
r = requests.get(s['url'] + xmlQuery,
auth=(s['user'], s['passwd']),
@ -75,6 +76,10 @@ def getMonit():
result=sorted_checks, s_rate=count)
output.append(server)
except:
server = dict(name=site, url=s['url'],
result=OrderedDict({'online': '1'}), s_rate={'green': 0, 'red': 1})
output.append(server)
print((datetime.datetime.now()))
return(output)