Add timeout to dashboard, show offline status if node times out for web api
This commit is contained in:
parent
9e2f369ad4
commit
de8b52b899
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue