Пример #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
                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']
    db_port = int(config['db_port'])

    if config['db_socket']: