Skip to content

Instantly share code, notes, and snippets.

@vertis
Created March 3, 2014 22:59
Show Gist options
  • Select an option

  • Save vertis/9336423 to your computer and use it in GitHub Desktop.

Select an option

Save vertis/9336423 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
from netaddr import IPNetwork
from subprocess import call
cidr = len(sys.argv) == 3 and sys.argv[2] or '24'
if sys.argv[1]:
ips = list(IPNetwork(sys.argv[1] + '/' + cidr))[1:-1]
for ip in ips:
print 'Trying connection to: ' + str(ip)
call(['serf', 'join', str(ip)])
else:
print 'Usage: serf-findpeers <myip>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment