[IMP]Uptime check : default timeout to 9; configurable
This commit is contained in:
parent
1c1e447db0
commit
59b5719c00
@ -9,9 +9,9 @@ from requests import get, post
|
||||
from config import HC_ROOT, CONFIG
|
||||
|
||||
|
||||
def check_domain(domain):
|
||||
def check_domain(domain, timeout):
|
||||
try:
|
||||
r = get('https://%s' % domain, timeout=6)
|
||||
r = get('https://%s' % domain, timeout=timeout)
|
||||
except Exception as e:
|
||||
return (e, 0)
|
||||
return (r.status_code, r.elapsed)
|
||||
@ -29,7 +29,7 @@ for check_item in CONFIG:
|
||||
fail = False
|
||||
data = []
|
||||
for domain in check_item['domains']:
|
||||
(status, timed) = check_domain(domain)
|
||||
(status, timed) = check_domain(domain, check_item.get('timeout', 9))
|
||||
if not fail and status != 200:
|
||||
fail = True
|
||||
if isinstance(status, Exception):
|
||||
|
Loading…
Reference in New Issue
Block a user