Exemple #1
0
def start_parser(parser, db):
    '''
    Starts the parser specified. 
    '''
    if auth(request):
        monitor.start(parser)
        return env.get_template('parsers.html').render(
            parsers=monitor.parser_status(),
            auth=auth(request), 
            status=monitor.status()
        )
    else:
        return env.get_template('parsers.html').render(
            error='Must be Authenticated to Start Parsers',
            parsers=monitor.parser_status(),
            auth=auth(request), 
            status=monitor.status()
        )
Exemple #2
0
def status_page(db):
    '''
    Parser Status Page. 
    '''
    return env.get_template('parsers.html').render(
        parsers=monitor.parser_status(),
        auth=auth(request), 
        status=monitor.status()
    )
Exemple #3
0
def services(db):
    '''
    Returns the running status of the services on the dofler sensor. 
    '''
    if auth(request) and request.method == 'POST':
        parser = request.forms.get('parser') or None
        action = request.forms.get('action') or None
        if action == 'Stop':
            monitor.stop(parser)
        if action == 'Start':
            monitor.start(parser)
        if action == 'Restart':
            monitor.stop(parser)
            monitor.start(parser)
    return jsonify(monitor.parser_status())
Exemple #4
0
def services(db):
    '''
    Returns the running status of the services on the dofler sensor. 
    '''
    if auth(request) and request.method == 'POST':
        parser = request.forms.get('parser') or None
        action = request.forms.get('action') or None
        if action == 'Stop':
            monitor.stop(parser)
        if action == 'Start':
            monitor.start(parser)
        if action == 'Restart':
            monitor.stop(parser)
            monitor.start(parser)
    return jsonify(monitor.parser_status())
Exemple #5
0
def services_settings(db):
    '''
    Services Status Page 
    '''
    if auth(request) and request.method == 'POST':
        parser = request.forms.get('parser')
        action = request.forms.get('action')
        if action == 'Stop':
            monitor.stop(parser)
        if action == 'Start':
            monitor.start(parser)
        if action == 'Restart':
            monitor.stop(parser)
            monitor.start(parser)
    return env.get_template('settings_services.html').render(
        auth=auth(request), parsers=monitor.parser_status())
Exemple #6
0
def services_settings(db):
    '''
    Services Status Page 
    '''
    if auth(request) and request.method == 'POST':
        parser = request.forms.get('parser')
        action = request.forms.get('action')
        if action == 'Stop':
            monitor.stop(parser)
        if action == 'Start':
            monitor.start(parser)
        if action == 'Restart':
            monitor.stop(parser)
            monitor.start(parser)
    return env.get_template('settings_services.html').render(
        auth=auth(request),
        parsers=monitor.parser_status()
    )
Exemple #7
0
def parsers_settings(db):
    '''
    Parser Configuration Settings Page
    '''
    if auth(request) and request.method == 'POST':
        settings = {}
        for item in request.forms:
            settings[item] = request.forms[item]
        update_settings(settings)
    parsers = {}
    for item in monitor.parser_status():
        parsers[item] = {
            'enabled': setting('%s_enabled' % item).boolvalue,
            'command': setting('%s_command' % item).value,
        }
    return env.get_template('settings_parsers.html').render(
        auth=auth(request),
        parsers=parsers,
        autostart=setting('autostart').boolvalue,
        listen_interface=setting('listen_interface').value)
Exemple #8
0
def parsers_settings(db):
    '''
    Parser Configuration Settings Page
    '''
    if auth(request) and request.method == 'POST':
        settings = {}
        for item in request.forms:
            settings[item] = request.forms[item]
        update_settings(settings)
    parsers = {}
    for item in monitor.parser_status():
        parsers[item] = {
            'enabled': setting('%s_enabled' % item).boolvalue,
            'command': setting('%s_command' % item).value,
        }
    return env.get_template('settings_parsers.html').render(
        auth=auth(request),
        parsers=parsers,
        autostart=setting('autostart').boolvalue,
        listen_interface=setting('listen_interface').value
    )