Example #1
0
def get_root_node(config=False):
    cpu = get_cpu_node()
    memory = get_memory_node()
    disk = get_disk_node(config)
    interface = get_interface_node()
    plugins = get_plugins_node()
    user = get_user_node()
    system = get_system_node()
    service = services.get_node()
    process = processes.get_node()

    children = [
        cpu, memory, disk, interface, plugins, user, system, service, process
    ]

    if environment.SYSTEM == "Windows":
        for importable in importables:
            try:
                relative_name = 'listener.' + importable
                tmp = __import__(relative_name, fromlist=['get_node'])
                get_node = getattr(tmp, 'get_node')

                node = get_node()
                children.append(node)
                logging.debug("Imported %s into the API tree.", importable)
            except ImportError:
                logging.warning("Could not import %s, skipping.", importable)
            except AttributeError:
                logging.warning(
                    "Trying to import %s but does not get_node() function, skipping.",
                    importable)

    return ParentNode('root', children=children)
Example #2
0
def get_root_node(config=False):
    cpu = get_cpu_node()
    memory = get_memory_node()
    disk = get_disk_node(config)
    interface = get_interface_node()
    plugins = get_plugins_node()
    user = get_user_node()
    system = get_system_node()
    service = services.get_node()
    process = processes.get_node()

    children = [cpu, memory, disk, interface, plugins, user, system, service, process]

    if environment.SYSTEM == "Windows":
        for importable in importables:
            try:
                relative_name = 'listener.' + importable
                tmp = __import__(relative_name, fromlist=['get_node'])
                get_node = getattr(tmp, 'get_node')

                node = get_node()
                children.append(node)
                logging.debug("Imported %s into the API tree.", importable)
            except ImportError:
                logging.warning("Could not import %s, skipping.", importable)
            except AttributeError:
                logging.warning("Trying to import %s but does not get_node() function, skipping.", importable)

    return ParentNode('root', children=children)