ret = subprocess.call('ping -c 1 %s' % ip, shell=True, stdout=open(
    '/dev/null', 'w'), stderr=subprocess.STDOUT)
if ret == 0:
    print('%s: is alive' % ip)
else:
    print('%s: did not respond' % ip)
q.task_done()
for i in range(num_threads):
    worker = Thread(target=pinger, args=(i, queue))
worker.setDaemon(True)
worker.start()
for ip in ips:
    queue.put(ip)
queue.join()
Пинговать сайт в Python?