Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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