Skip to content

Instantly share code, notes, and snippets.

@syuhei176
Last active November 27, 2015 06:03
Show Gist options
  • Save syuhei176/513d0605feb2407b7dd6 to your computer and use it in GitHub Desktop.
Save syuhei176/513d0605feb2407b7dd6 to your computer and use it in GitHub Desktop.
Check cassandra status
import subprocess
import sys, re
hostname = 'cassandra host'
check = subprocess.check_output(['nodetool', '-h', hostname, 'status'])
line = check.split('\n')
for l in line:
m = re.match(r"DN" , l)
if m:
print("Down")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment