Example #1
0
def computeStats(node_name, _az2, dic, zone, i, client, r_outs=None, opt=None):

    startTime = time.time()

    print "Getting data from zone %s" % node_name

    node_info = returnNodes(client, zone, i)
    nodes_count = len(node_info)

    nodes_rc = stats_count(get_Resources(node_info,
                                          client))
    type_ = totalVMType(dic, returnServers(client, _az2))
    if 'others' in list(type_.elements()):
        others = type_['others']
    else:
        others = 0

    print "%s done , took %0.2f secs" % (node_name, (time.time() - startTime))

    stats_q = {'node_name': node_name, 'node_count': nodes_count,
                'nac': nodes_rc.get('nac'), 'nam': nodes_rc.get('nam'),
                'nuc': nodes_rc.get('nuc'), 'num': nodes_rc.get('num'),
                'nfc': nodes_rc.get('nfc'), 'nfm': nodes_rc.get('nfm'),
                't_s': type_['m1.small'], 't_m': type_['m1.medium'],
                't_l': type_['m1.large'], 't_xl': type_['m1.xlarge'],
                't_xxl': type_['m1.xxlarge'], 'oth': others
                }

    if opt == True:
        r_outs.put(stats_q)
    else:
        return stats_q
Example #2
0
def compute_stats(node_name, zone, cell_name, client):
    node_info = returnNodes(client, zone, cell_name)
    nodes_count = len(node_info)
    nodes_rc = statsCount(getResources(node_info, client))
    stats = {'node_name': node_name,
             'node_count': nodes_count}
    for metric, value in nodes_rc.items():
        stats[metric] = value
    return stats
Example #3
0
def computeStats(node_name, _az2, dic, zone, i, client, r_outs=None, opt=None):

    startTime = time.time()

    print "Getting data from zone %s" % node_name

    node_info = returnNodes(client, zone, i)
    nodes_count = len(node_info)

    nodes_rc = stats_count(get_Resources(node_info, client))
    type_ = totalVMType(dic, returnServers(client, _az2))
    if 'others' in list(type_.elements()):
        others = type_['others']
    else:
        others = 0

    print "%s done , took %0.2f secs" % (node_name, (time.time() - startTime))

    stats_q = {
        'node_name': node_name,
        'node_count': nodes_count,
        'nac': nodes_rc.get('nac'),
        'nam': nodes_rc.get('nam'),
        'nuc': nodes_rc.get('nuc'),
        'num': nodes_rc.get('num'),
        'nfc': nodes_rc.get('nfc'),
        'nfm': nodes_rc.get('nfm'),
        't_s': type_['m1.small'],
        't_m': type_['m1.medium'],
        't_l': type_['m1.large'],
        't_xl': type_['m1.xlarge'],
        't_xxl': type_['m1.xxlarge'],
        'oth': others
    }

    if opt == True:
        r_outs.put(stats_q)
    else:
        return stats_q