示例#1
0
                elapsed_time = int(time.time() - start_time)
                print_queue.put(
                    [threading.current_thread().name, device_id, elapsed_time])
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                pass
        poll_queue.task_done()


if __name__ == '__main__':
    logger = LNMS.logger_get_logger(LOG_FILE, debug=_DEBUG)

    install_dir = os.path.dirname(os.path.realpath(__file__))
    LNMS.check_for_file(install_dir + '/.env')
    config = json.loads(LNMS.get_config_data(install_dir))

    poller_path = config['install_dir'] + '/poller.php'
    log_dir = config['log_dir']

    if 'rrd' in config and 'step' in config['rrd']:
        step = config['rrd']['step']
    else:
        step = 300

    # (c) 2015, GPLv3, Daniel Preussker <*****@*****.**> <<<EOC1
    if 'distributed_poller_group' in config:
        poller_group = str(config['distributed_poller_group'])
    else:
        poller_group = False
示例#2
0
                print_queue.put(
                    [threading.current_thread().name, device_id, elapsed_time])
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                pass
        poll_queue.task_done()


if __name__ == '__main__':
    logger = LNMS.logger_get_logger(LOG_FILE, debug=_DEBUG)

    install_dir = os.path.dirname(os.path.realpath(__file__))
    config_file = install_dir + '/config.php'

    LNMS.check_for_file(config_file)

    try:
        conf = LNMS.get_config_data(install_dir)
        config = json.loads(conf)
    except:
        print(
            "ERROR: Could not load or parse configuration, are PATHs correct?")
        sys.exit(2)

    service_path = config['install_dir'] + '/check-services.php'
    log_dir = config['log_dir']

    # TODO: Use LibreNMS.DB
    db_username = config['db_user']
    db_password = config['db_pass']
示例#3
0
                elapsed_time = int(time.time() - start_time)
                print_queue.put(
                    [threading.current_thread().name, device_id, elapsed_time])
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                pass
        poll_queue.task_done()


if __name__ == '__main__':
    logger = LNMS.logger_get_logger(LOG_FILE, debug=_DEBUG)

    install_dir = os.path.dirname(os.path.realpath(__file__))
    LNMS.check_for_file(install_dir + '/config.php')
    config = json.loads(LNMS.get_config_data(install_dir))

    service_path = config['install_dir'] + '/check-services.php'
    log_dir = config['log_dir']

    # TODO: Use LibreNMS.DB
    db_username = config['db_user']
    db_password = config['db_pass']
    db_port = int(config['db_port'])

    if config['db_socket']:
        db_server = config['db_host']
        db_socket = config['db_socket']
    else:
        db_server = config['db_host']
示例#4
0
                elapsed_time = int(time.time() - start_time)
                print_queue.put(
                    [threading.current_thread().name, device_id, elapsed_time]
                )
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                pass
        poll_queue.task_done()


if __name__ == "__main__":
    logger = LNMS.logger_get_logger(LOG_FILE, debug=_DEBUG)

    install_dir = os.path.dirname(os.path.realpath(__file__))
    LNMS.check_for_file(install_dir + "/.env")
    config = json.loads(LNMS.get_config_data(install_dir))

    discovery_path = config["install_dir"] + "/discovery.php"
    log_dir = config["log_dir"]

    # (c) 2015, GPLv3, Daniel Preussker <*****@*****.**> <<<EOC1
    if "distributed_poller_group" in config:
        discovery_group = str(config["distributed_poller_group"])
    else:
        discovery_group = False

    if (
        "distributed_poller" in config
        and "distributed_poller_memcached_host" in config
        and "distributed_poller_memcached_port" in config