Example #1
0
def _do_start(args):
  tank_ip = build_utils.get_build_info_option('tank', 'tank_ip')
  tank_port = build_utils.get_build_info_option('tank', 'tank_port')
  if tank_ip and tank_port:
    args.tank_ip = tank_ip
    args.tank_port = int(tank_port)

  build_utils.start_daemon_process('Tank server', TANK_PID_FILE,
    TANK_ROOT, './start_tank.sh', args.tank_ip, str(args.tank_port))
Example #2
0
def _do_start(args):
    tank_ip = build_utils.get_build_info_option('tank', 'tank_ip')
    tank_port = build_utils.get_build_info_option('tank', 'tank_port')
    if tank_ip and tank_port:
        args.tank_ip = tank_ip
        args.tank_port = int(tank_port)

    build_utils.start_daemon_process('Tank server', TANK_PID_FILE, TANK_ROOT,
                                     './start_tank.sh', args.tank_ip,
                                     str(args.tank_port))
Example #3
0
def start_owl_monitor():
  owl_monitor_http_port = build_utils.get_build_info_option('owl', 'owl_port')
  if not owl_monitor_http_port:
    Log.print_critical("Owl port is null")

  build_utils.start_daemon_process('Owl monitor', OWL_MONITOR_PID_FILE,
    OWL_ROOT, './start_owl_monitor.sh', owl_monitor_http_port)
Example #4
0
def start_owl_monitor():
    owl_monitor_http_port = build_utils.get_build_info_option(
        'owl', 'owl_port')
    if not owl_monitor_http_port:
        Log.print_critical("Owl port is null")

    build_utils.start_daemon_process('Owl monitor', OWL_MONITOR_PID_FILE,
                                     OWL_ROOT, './start_owl_monitor.sh',
                                     owl_monitor_http_port)
Example #5
0
def create_hbase_table():
  if build_utils.get_build_info_option('owl', 'hbase_table') == 'created':
    return
  os.chdir(OPENTSDB_ROOT)
  log_message = "Creating hbase table for opentsdb in %s" % OPENTSDB_ROOT
  cmd = ["env", "COMPRESSION=NONE", "HBASE_HOME=%s" % HBASE_ROOT, "./src/create_table.sh"]
  build_utils.execute_command(cmd, log_message=log_message)
  os.chdir(MINOS_ROOT)

  # Mark hbase table created
  build_utils.output_build_info('owl', 'hbase_table', 'created')
Example #6
0
def create_hbase_table():
    if build_utils.get_build_info_option('owl', 'hbase_table') == 'created':
        return
    os.chdir(OPENTSDB_ROOT)
    log_message = "Creating hbase table for opentsdb in %s" % OPENTSDB_ROOT
    cmd = [
        "env", "COMPRESSION=NONE",
        "HBASE_HOME=%s" % HBASE_ROOT, "./src/create_table.sh"
    ]
    build_utils.execute_command(cmd, log_message=log_message)
    os.chdir(MINOS_ROOT)

    # Mark hbase table created
    build_utils.output_build_info('owl', 'hbase_table', 'created')
Example #7
0
def create_and_configure_mysql_for_owl(args):
    if build_utils.get_build_info_option('owl', 'mysql') == 'created':
        return
    # Support both local and remote database
    choice = raw_input("Please choose Mysql server you want to use " \
      "(1 for Local, 2 for Remote): ")
    owl_prefix = raw_input("Please enter the prefix of your owl database name " \
      "(default: %s): " % getpass.getuser())
    if not owl_prefix:
        owl_prefix = getpass.getuser()
    database_name = "%s_owl" % owl_prefix

    # Using local mysql
    if int(choice) == 1:
        # Check mysql server is running
        cmd = 'ps -ef | grep mysqld | grep -v grep'
        error_message = "Please start mysql server firstly"
        build_utils.check_command_output(cmd, error_message=error_message)
        # Create owl database
        create_owl_database(args, database_name)
        # Configure mysql for owl
        configure_mysql_for_owl(database_name)

    # Using remote mysql
    elif int(choice) == 2:
        remote_address = raw_input("Please input the remote mysql " \
          "server's address (ip:port): ")
        remote_host, remote_port = remote_address.split(":")
        # Create owl database
        create_owl_database(args,
                            database_name,
                            host=remote_host,
                            port=remote_port)
        # Configure mysql for owl
        configure_mysql_for_owl(database_name, remote_host, remote_port)
    else:
        Log.print_critical("ERROR: invalid choice")

    # Mark mysql database created
    build_utils.output_build_info('owl', 'mysql', 'created')
Example #8
0
def build_hbase():
  if build_utils.get_build_info_option('owl', 'hbase') == 'built':
    return

  if not os.path.exists(BUILD_DOWNLOAD_ROOT):
    os.mkdir(BUILD_DOWNLOAD_ROOT)
  os.chdir(BUILD_DOWNLOAD_ROOT)

  log_message = "Setup hbase in %s" % BUILD_DOWNLOAD_ROOT
  if not os.path.exists(os.path.basename(HBASE_TARBALL)):
    cmd = ["wget", "%s" % HBASE_TARBALL]
    build_utils.execute_command(cmd, log_message=log_message)

  if not os.path.exists(HBASE_ROOT):
    cmd = ["tar", "xfz", "%s" % os.path.basename(HBASE_TARBALL)]
    build_utils.execute_command(cmd)

  generate_hbase_configuration()
  os.chdir(MINOS_ROOT)

  # Mark hbase built
  build_utils.output_build_info('owl', 'hbase', 'built')
Example #9
0
def build_hbase():
    if build_utils.get_build_info_option('owl', 'hbase') == 'built':
        return

    if not os.path.exists(BUILD_DOWNLOAD_ROOT):
        os.mkdir(BUILD_DOWNLOAD_ROOT)
    os.chdir(BUILD_DOWNLOAD_ROOT)

    log_message = "Setup hbase in %s" % BUILD_DOWNLOAD_ROOT
    if not os.path.exists(os.path.basename(HBASE_TARBALL)):
        cmd = ["wget", "%s" % HBASE_TARBALL]
        build_utils.execute_command(cmd, log_message=log_message)

    if not os.path.exists(HBASE_ROOT):
        cmd = ["tar", "xfz", "%s" % os.path.basename(HBASE_TARBALL)]
        build_utils.execute_command(cmd)

    generate_hbase_configuration()
    os.chdir(MINOS_ROOT)

    # Mark hbase built
    build_utils.output_build_info('owl', 'hbase', 'built')
Example #10
0
def create_and_configure_mysql_for_owl(args):
  if build_utils.get_build_info_option('owl', 'mysql') == 'created':
    return
  # Support both local and remote database
  choice = raw_input("Please choose Mysql server you want to use " \
    "(1 for Local, 2 for Remote): ")
  owl_prefix = raw_input("Please enter the prefix of your owl database name " \
    "(default: %s): " % getpass.getuser())
  if not owl_prefix:
    owl_prefix = getpass.getuser()
  database_name = "%s_owl" % owl_prefix

  # Using local mysql
  if int(choice) == 1:
    # Check mysql server is running
    cmd = 'ps -ef | grep mysqld | grep -v grep'
    error_message = "Please start mysql server firstly"
    build_utils.check_command_output(cmd, error_message=error_message)
    # Create owl database
    create_owl_database(args, database_name)
    # Configure mysql for owl
    configure_mysql_for_owl(database_name)

  # Using remote mysql
  elif int(choice) == 2:
    remote_address = raw_input("Please input the remote mysql " \
      "server's address (ip:port): ")
    remote_host, remote_port = remote_address.split(":")
    # Create owl database
    create_owl_database(args, database_name, host=remote_host, port=remote_port)
    # Configure mysql for owl
    configure_mysql_for_owl(database_name, remote_host, remote_port)
  else:
    Log.print_critical("ERROR: invalid choice")

  # Mark mysql database created
  build_utils.output_build_info('owl', 'mysql', 'created')
Example #11
0
def start(args):
  if not build_utils.get_build_info_option('tank', 'build_status') == 'success':
    _build(args)
  _do_start(args)
Example #12
0
def start(args):
    if not build_utils.get_build_info_option('tank',
                                             'build_status') == 'success':
        _build(args)
    _do_start(args)