[FIX]Uptime error should continue checks
This commit is contained in:
parent
da6c88b889
commit
d1ae463a67
@ -13,7 +13,7 @@ def check_domain(domain):
|
|||||||
try:
|
try:
|
||||||
r = get('https://%s' % domain)
|
r = get('https://%s' % domain)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return e
|
return (e, 0)
|
||||||
return (r.status_code, r.elapsed)
|
return (r.status_code, r.elapsed)
|
||||||
|
|
||||||
def ping_with_info(url, fail=False, data=None):
|
def ping_with_info(url, fail=False, data=None):
|
||||||
@ -32,8 +32,11 @@ for check_item in CONFIG:
|
|||||||
(status, timed) = check_domain(domain)
|
(status, timed) = check_domain(domain)
|
||||||
if not fail and status != 200:
|
if not fail and status != 200:
|
||||||
fail = True
|
fail = True
|
||||||
data.append('%s : %s (%sms)' % (
|
if isinstance(status, Exception):
|
||||||
domain, status, round(timed.total_seconds() * 1000.0)
|
data.append('%s : %s' % (domain, status))
|
||||||
))
|
else:
|
||||||
|
data.append('%s : %s (%sms)' % (
|
||||||
|
domain, status, round(timed.total_seconds() * 1000.0)
|
||||||
|
))
|
||||||
url = '%s/ping/%s' % (HC_ROOT, check_item['uuid'])
|
url = '%s/ping/%s' % (HC_ROOT, check_item['uuid'])
|
||||||
ping_with_info(url, fail=fail, data='\n'.join(data))
|
ping_with_info(url, fail=fail, data='\n'.join(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user