From a4a105fb15fb04feb07522264f665da04ed25294 Mon Sep 17 00:00:00 2001 From: shehbaz-pathan <46107507+shehbaz-pathan@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:51:31 +0530 Subject: [PATCH] Updated node health check to remove duplicate nodes (#55) Co-authored-by: shehbaz-pathan --- tools/system-health-check/health_check.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/system-health-check/health_check.py b/tools/system-health-check/health_check.py index 83da233..4f1ed03 100644 --- a/tools/system-health-check/health_check.py +++ b/tools/system-health-check/health_check.py @@ -206,13 +206,17 @@ def pvc_check(): def node_check(): failed = [] + failed_unique = [] + try: response = requests.get(prometheus_url, params={'query': node_health_query}) response_json = json.loads(response.text) if response_json['data']['result']: for result in response_json['data']['result']: - failed.append("Node - "+ result['metric']['instance'] + " is not healthy") - return failed + instance = str(result['metric']['instance']).split(":") + failed.append("Node - "+ instance[0] + " is not healthy") + failed_unique=list(set(failed)) + return failed_unique except Exception as e: logger.error("%s Exception occured while checking nodes health", str(e)) return failed