[IMP]Uptime check : get all exceptions from ping

This commit is contained in:
Fabien BOURGEOIS 2021-05-13 17:49:30 +02:00
parent 9d7e05afe2
commit f5e17db104

View File

@ -6,7 +6,7 @@ Usage of own healthchecks.io instance and ENV
""" """
from os import environ from os import environ
from requests import get, post, RequestException from requests import get, post
hc_root = environ.get('HC_ROOT', '') hc_root = environ.get('HC_ROOT', '')
# HOSTS are in form hostname|uuid:hostname2|uuid... # HOSTS are in form hostname|uuid:hostname2|uuid...
@ -32,7 +32,7 @@ def ping_with_info(url, fail=False, data=None):
if fail: if fail:
url = '%s/fail' % url url = '%s/fail' % url
post(url, timeout=10, data=data) post(url, timeout=10, data=data)
except RequestException as e: except Exception as e:
print("Ping failed: %s" % e) print("Ping failed: %s" % e)
for host, settings in config.items(): for host, settings in config.items():