From bcea4d5b9043ebd76ed0c0bad60b62f61c6467ce Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 10 Sep 2021 17:00:37 +0200 Subject: [PATCH] do not send message on server down --- setup-scripts/health-checker.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup-scripts/health-checker.py b/setup-scripts/health-checker.py index 8d67e4e1..8ce62a54 100755 --- a/setup-scripts/health-checker.py +++ b/setup-scripts/health-checker.py @@ -133,7 +133,7 @@ async def check_health(): res = requests.get(endpoint + "/health-check", verify=False) json_check = res.json() - server_down = res.status_code is not requests.codes["ok"] + server_failure = res.status_code is not requests.codes["ok"] and json_check["disabled"] == False: res = requests.get(endpoint + "/health-check/critical", verify=False) json_critical = res.json() @@ -201,8 +201,8 @@ async def check_health(): message = "" force_notify = False - if server_down and json_check["disabled"] == False: - message += "__Portal down!!!__ " + if server_failure: + message += "__Server down!!!__ " force_notify = True if critical_checks_failed: @@ -227,7 +227,6 @@ async def check_health(): # send a message if we force notification, there is a failures dump or just once daily (heartbeat) on 1 AM if ( force_notify - or json_check["disabled"] or failed_records_file or datetime.utcnow().hour == 1 ):