Created
August 29, 2018 23:51
-
-
Save haginara/2d76edab1f3fb238729f0787d1387a92 to your computer and use it in GitHub Desktop.
Check Health status of Elasticsearch on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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