Exemplo n.º 1
0
def get_cpu_mem():
    spark_param = Worm.get_html('http://11.11.0.56:5000/', True, 6).split('#')
    spark_cpu = float(spark_param[0])
    spark_mem = float(spark_param[1])
    flint_param = Worm.get_html('http://11.11.0.65:5000/', True, 6).split('#')
    flint_cpu = float(flint_param[0])
    flint_mem = float(flint_param[1])
    f**k = {'spark_cpu': spark_cpu, 'spark_mem': spark_mem, 'flint_cpu': flint_cpu, 'flint_mem': flint_mem}
    print f**k
    shit = json.dumps(f**k)

    return shit
Exemplo n.º 2
0
def get_gc():
    final_dict = {}
    try:
       spark_worm = Worm(spark_url, spark_stage_url, True, True, "Spark")
       running_spark = spark_worm.get_running_spark()
       if running_spark is None:
           running_spark = spark_worm.get_finish_spark()  #get the first finished
       flint_worm = Worm(flint_url, flint_stage_url, True, True,  "Flint")
       running_flint = flint_worm.get_running_spark()
       if running_flint is None:
           running_flint = flint_worm.get_finish_spark()
    except Exception, e:
        print e
        return None
Exemplo n.º 3
0
def get_json():
    """
    you can transform the ip of node which you want to monitor
    :return:
    """
    final_dict = {}
    try:
       spark_worm = Worm(spark_url, spark_stage_url, True, False, "Spark")
       running_spark = spark_worm.get_running_spark()
       if running_spark is None:
           running_spark = spark_worm.get_finish_spark()  #get the first finished
       flint_worm = Worm(flint_url, flint_stage_url, True, False,  "Flint")
       running_flint = flint_worm.get_running_spark()
       if running_flint is None:
           running_flint = flint_worm.get_finish_spark()
    except Exception, e:
        print e
        return None