def start_zookeeper(zk_ips, keyname):
 logging.info('Starting ZooKeeper...')
 for ip in zk_ips:
  start_service_cmd = (START_SERVICE_SCRIPT + ZK_WATCH_NAME)
  try:
   utils.ssh(ip, keyname, start_service_cmd)
  except subprocess.CalledProcessError:
   message = 'Unable to start ZooKeeper on {}'.format(ip)
   logging.exception(message)
   raise ZKInternalException(message)
 logging.info('Waiting for ZooKeeper to be ready')
 zk_server_cmd = None
 for script in ZK_SERVER_CMD_LOCATIONS:
  if os.path.isfile(script):
   zk_server_cmd = script
   break
 if (zk_server_cmd is None):
  raise ZKInternalException('Unable to find zkServer.sh')
 status_cmd = '{} status'.format(zk_server_cmd)
 while (utils.ssh(zk_ips[0], keyname, status_cmd, method=subprocess.call) != 0):
  time.sleep(5)
 logging.info('Successfully started ZooKeeper.')

def start_zookeeper ( zk_ips , keyname ) : logging . info ( 'Starting ZooKeeper...' ) for ip in zk_ips : start_service_cmd = ( START_SERVICE_SCRIPT + ZK_WATCH_NAME ) try : utils . ssh ( ip , keyname , start_service_cmd ) except subprocess . CalledProcessError : message = 'Unable to start ZooKeeper on {}' . format ( ip ) logging . exception ( message ) raise ZKInternalException ( message ) logging . info ( 'Waiting for ZooKeeper to be ready' ) zk_server_cmd = None for script in ZK_SERVER_CMD_LOCATIONS : if os . path . isfile ( script ) : zk_server_cmd = script break if ( zk_server_cmd is None ) : raise ZKInternalException ( 'Unable to find zkServer.sh' ) status_cmd = '{} status' . format ( zk_server_cmd ) while ( utils . ssh ( zk_ips [ 0 ] , keyname , status_cmd , method = subprocess . call ) != 0 ) : time . sleep ( 5 ) logging . info ( 'Successfully started ZooKeeper.' )
creates a monit configuration file and prompts monit to start zookeeper .