Skip to content

Commit

Permalink
Updated node health check to remove duplicate nodes (#55)
Browse files Browse the repository at this point in the history
Co-authored-by: shehbaz-pathan <[email protected]>
  • Loading branch information
shehbaz-pathan and shehbaz-pathan authored Jan 28, 2025
1 parent 009a2e8 commit a4a105f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/system-health-check/health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a4a105f

Please sign in to comment.