Ejemplo n.º 1
0
def update_glob(rrds_dir, glob_moni):
    glob_rrds_dir = os.path.join(rrds_dir, 'glob')
    try:
        mkdirs(glob_rrds_dir)
    except:
        raise

    load_rrd_path = os.path.join(glob_rrds_dir, 'load.rrd')
    mem_rrd_path = os.path.join(glob_rrds_dir, 'mem.rrd')
    swap_rrd_path = os.path.join(glob_rrds_dir, 'swap.rrd')
    nw_rrd_path = os.path.join(glob_rrds_dir, 'nw.rrd')
    iops_rrd_path = os.path.join(glob_rrds_dir, 'iops.rrd')
    disk_rrd_path = os.path.join(glob_rrds_dir, 'disk.rrd')

    try:
        if 'load' in glob_moni.keys() and glob_moni['load']:
            load.update(load_rrd_path, glob_moni['load'])
        if 'mem' in glob_moni.keys() and glob_moni['mem']:
            mem.update(mem_rrd_path, glob_moni['mem'])
        if 'swap' in glob_moni.keys() and glob_moni['swap']:
            swap.update(swap_rrd_path, glob_moni['swap'])
        if 'nw' in glob_moni.keys() and glob_moni['nw']:
            nw.update(nw_rrd_path, glob_moni['nw'])
        if 'iops' in glob_moni.keys() and glob_moni['iops']:
            iops.update(iops_rrd_path, glob_moni['iops'])
        if 'disk' in glob_moni.keys() and glob_moni['disk']:
            disk.update(disk_rrd_path, glob_moni['disk'])
    except:
        raise
Ejemplo n.º 2
0
Archivo: updater.py Proyecto: e42s/uss
def update_nodes(rrds_dir, nodes_moni):
    """
    :param node: dict of the node, like: {'id':1, 'rack':1},
    :param node: dict of the node would be updated into rrd, likes:
                    {'load':[],
                     'mem':[],
                     'swap':[],
                     'nw':[],
                     'iops':[]}
    """
    for node in nodes_moni:
        node_dir = os.path.join(rrds_dir, str(node['rack']), str(node['id']))
        try: mkdirs(node_dir)
        except: raise

        load_rrd_path = os.path.join(node_dir, 'load.rrd')
        mem_rrd_path = os.path.join(node_dir, 'mem.rrd')
        swap_rrd_path = os.path.join(node_dir, 'swap.rrd')
        nw_rrd_path = os.path.join(node_dir, 'nw.rrd')
        iops_rrd_path = os.path.join(node_dir, 'iops.rrd')
        disk_rrd_path = os.path.join(node_dir, 'disk.rrd')

        try:
            if 'load' in node.keys() and node['load']: load.update(load_rrd_path, node['load'])
            if 'mem' in node.keys() and node['mem']: mem.update(mem_rrd_path, node['mem'])
            if 'swap' in node.keys() and node['swap']: swap.update(swap_rrd_path, node['swap'])
            if 'nw' in node.keys() and node['nw']: nw.update(nw_rrd_path, node['nw'])
            if 'iops' in node.keys() and node['iops']: iops.update(iops_rrd_path, node['iops'])
            if 'disk' in node.keys() and node['disk']: disk.update(disk_rrd_path, node['disk'])
        except:
            raise
Ejemplo n.º 3
0
Archivo: updater.py Proyecto: e42s/uss
def update_racks(rrds_dir, racks_moni):

    for rack_id in racks_moni.keys():
        rack_rrds_dir = os.path.join(rrds_dir, str(rack_id), 'rack')
        try: mkdirs(rack_rrds_dir)
        except: raise

        load_rrd_path = os.path.join(rack_rrds_dir, 'load.rrd')
        mem_rrd_path = os.path.join(rack_rrds_dir, 'mem.rrd')
        swap_rrd_path = os.path.join(rack_rrds_dir, 'swap.rrd')
        nw_rrd_path = os.path.join(rack_rrds_dir, 'nw.rrd')
        iops_rrd_path = os.path.join(rack_rrds_dir, 'iops.rrd')
        disk_rrd_path = os.path.join(rack_rrds_dir, 'disk.rrd')

        try:
            if 'load' in racks_moni[rack_id].keys() and racks_moni[rack_id]['load']:
                load.update(load_rrd_path, racks_moni[rack_id]['load'])
            if 'mem' in racks_moni[rack_id].keys() and racks_moni[rack_id]['mem']:
                mem.update(mem_rrd_path, racks_moni[rack_id]['mem'])
            if 'swap' in racks_moni[rack_id].keys() and racks_moni[rack_id]['swap']:
                swap.update(swap_rrd_path, racks_moni[rack_id]['swap'])
            if 'nw' in racks_moni[rack_id].keys() and racks_moni[rack_id]['nw']:
                nw.update(nw_rrd_path, racks_moni[rack_id]['nw'])
            if 'iops' in racks_moni[rack_id].keys() and racks_moni[rack_id]['iops']:
                iops.update(iops_rrd_path, racks_moni[rack_id]['iops'])
            if 'disk' in racks_moni[rack_id].keys() and racks_moni[rack_id]['disk']:
                disk.update(disk_rrd_path, racks_moni[rack_id]['disk'])
        except:
            raise
Ejemplo n.º 4
0
def update_nodes(rrds_dir, nodes_moni):
    """
    :param node: dict of the node, like: {'id':1, 'rack':1},
    :param node: dict of the node would be updated into rrd, likes:
                    {'load':[],
                     'mem':[],
                     'swap':[],
                     'nw':[],
                     'iops':[]}
    """
    for node in nodes_moni:
        node_dir = os.path.join(rrds_dir, str(node['rack']), str(node['id']))
        try:
            mkdirs(node_dir)
        except:
            raise

        load_rrd_path = os.path.join(node_dir, 'load.rrd')
        mem_rrd_path = os.path.join(node_dir, 'mem.rrd')
        swap_rrd_path = os.path.join(node_dir, 'swap.rrd')
        nw_rrd_path = os.path.join(node_dir, 'nw.rrd')
        iops_rrd_path = os.path.join(node_dir, 'iops.rrd')
        disk_rrd_path = os.path.join(node_dir, 'disk.rrd')

        try:
            if 'load' in node.keys() and node['load']:
                load.update(load_rrd_path, node['load'])
            if 'mem' in node.keys() and node['mem']:
                mem.update(mem_rrd_path, node['mem'])
            if 'swap' in node.keys() and node['swap']:
                swap.update(swap_rrd_path, node['swap'])
            if 'nw' in node.keys() and node['nw']:
                nw.update(nw_rrd_path, node['nw'])
            if 'iops' in node.keys() and node['iops']:
                iops.update(iops_rrd_path, node['iops'])
            if 'disk' in node.keys() and node['disk']:
                disk.update(disk_rrd_path, node['disk'])
        except:
            raise
Ejemplo n.º 5
0
Archivo: updater.py Proyecto: e42s/uss
def update_glob(rrds_dir, glob_moni):
    glob_rrds_dir = os.path.join(rrds_dir, 'glob')
    try: mkdirs(glob_rrds_dir)
    except: raise

    load_rrd_path = os.path.join(glob_rrds_dir, 'load.rrd')
    mem_rrd_path = os.path.join(glob_rrds_dir, 'mem.rrd')
    swap_rrd_path = os.path.join(glob_rrds_dir, 'swap.rrd')
    nw_rrd_path = os.path.join(glob_rrds_dir, 'nw.rrd')
    iops_rrd_path = os.path.join(glob_rrds_dir, 'iops.rrd')
    disk_rrd_path = os.path.join(glob_rrds_dir, 'disk.rrd')



    try:
        if 'load' in glob_moni.keys() and glob_moni['load']: load.update(load_rrd_path, glob_moni['load'])
        if 'mem' in glob_moni.keys() and glob_moni['mem']: mem.update(mem_rrd_path, glob_moni['mem'])
        if 'swap' in glob_moni.keys() and glob_moni['swap']: swap.update(swap_rrd_path, glob_moni['swap'])
        if 'nw' in glob_moni.keys() and glob_moni['nw']: nw.update(nw_rrd_path, glob_moni['nw'])
        if 'iops' in glob_moni.keys() and glob_moni['iops']: iops.update(iops_rrd_path, glob_moni['iops'])
        if 'disk' in glob_moni.keys() and glob_moni['disk']: disk.update(disk_rrd_path, glob_moni['disk'])
    except:
        raise
Ejemplo n.º 6
0
def update_racks(rrds_dir, racks_moni):

    for rack_id in racks_moni.keys():
        rack_rrds_dir = os.path.join(rrds_dir, str(rack_id), 'rack')
        try:
            mkdirs(rack_rrds_dir)
        except:
            raise

        load_rrd_path = os.path.join(rack_rrds_dir, 'load.rrd')
        mem_rrd_path = os.path.join(rack_rrds_dir, 'mem.rrd')
        swap_rrd_path = os.path.join(rack_rrds_dir, 'swap.rrd')
        nw_rrd_path = os.path.join(rack_rrds_dir, 'nw.rrd')
        iops_rrd_path = os.path.join(rack_rrds_dir, 'iops.rrd')
        disk_rrd_path = os.path.join(rack_rrds_dir, 'disk.rrd')

        try:
            if 'load' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['load']:
                load.update(load_rrd_path, racks_moni[rack_id]['load'])
            if 'mem' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['mem']:
                mem.update(mem_rrd_path, racks_moni[rack_id]['mem'])
            if 'swap' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['swap']:
                swap.update(swap_rrd_path, racks_moni[rack_id]['swap'])
            if 'nw' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['nw']:
                nw.update(nw_rrd_path, racks_moni[rack_id]['nw'])
            if 'iops' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['iops']:
                iops.update(iops_rrd_path, racks_moni[rack_id]['iops'])
            if 'disk' in racks_moni[rack_id].keys(
            ) and racks_moni[rack_id]['disk']:
                disk.update(disk_rrd_path, racks_moni[rack_id]['disk'])
        except:
            raise