Skip to content

Instantly share code, notes, and snippets.

@progrium
Created September 16, 2014 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save progrium/93c6a98a8af9a548a099 to your computer and use it in GitHub Desktop.
Save progrium/93c6a98a8af9a548a099 to your computer and use it in GitHub Desktop.
def healthy_nodes():
nodes = requests.get("http://localhost:8500/v1/health/nodes").json()
passing = requests.get("http://localhost:8500/v1/health/state/passing").json()
passing = [c["Node"] for c in passing if c["CheckID"] == "serfHealth"]
return [n for n in nodes if n["Node"] in passing]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment