Skip to content

Instantly share code, notes, and snippets.

@haginara
Created August 29, 2018 23:51
Show Gist options
  • Save haginara/2d76edab1f3fb238729f0787d1387a92 to your computer and use it in GitHub Desktop.
Save haginara/2d76edab1f3fb238729f0787d1387a92 to your computer and use it in GitHub Desktop.
Check Health status of Elasticsearch on Windows
import ctypes
import requests
ctypes.windll.user32.MessageBoxW(0, "Start", "start", 0)
check = False
while True:
data = requests.get('http://elk.nexon.net:9200/_cluster/health').json()
status = data.get('status')
if status == 'green':
if check is False:
ctypes.windll.user32.MessageBoxW(0, "Green", "Green", 0)
check = True
print(status)
else:
print("status: {:<6}, unassigned_shards : {:<10}".format(status, data.get("unassigned_shards")))
check = False
time.sleep(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment