Skip to content

Instantly share code, notes, and snippets.

@cholcombe973
Created February 2, 2016 22:28
Show Gist options
  • Save cholcombe973/468572a9bf73efb6f87d to your computer and use it in GitHub Desktop.
Save cholcombe973/468572a9bf73efb6f87d to your computer and use it in GitHub Desktop.
import json
import subprocess
import time
not_healthy = True
iterations = 0 # Make this configurable
# Loop here until timeout is reached
while not_healthy:
if iterations > 60:
# It's been 10 minutes. Continue on.
break
out = subprocess.check_output(['ceph','-s', '--format=json'])
j = json.loads(out)
j['health']['summary']
if not j['health']['summary']:
time.sleep(10) # Try again in 10 seconds. # Also make this configurable.
iterations = iterations + 1
continue
else:
not_healthy = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment