Exemplo n.º 1
0
def show_hosts():
    """ From a filter or no filter display a list of hosts. """
    extra_filters = gather_filters(request)
    host_list = query.get_hosts(
    columns='name state last_check last_state_change plugin_output acknowledged scheduled_downtime_depth notifications_enabled max_check_attempts current_attempt',
    extra_filter=extra_filters)
    host_stats = query.hosts_stats(extra_filter=extra_filters)
    return render_template('host_list.template',
    host_list=host_list, host_stats=host_stats, settings=settings )
Exemplo n.º 2
0
def tac():
    """ The 'Tactical Monitoring Overview', this will show an overview of all 
    the services: up, down, warning, error, etc.
    """
    extra_filters = gather_filters(request)
    try:
        service_stats = query.service_stats(extra_filter=extra_filters)
        host_stats = query.hosts_stats(extra_filter=extra_filters)
    except query.livestatus.MKLivestatusSocketError as error:
        error_message = """
        SimpleNagios received an error trying to connect to the nagios broker.
        <Br />
        You might want to check you'r settings.py file and make sure that nagios
        is currently running as expected.
        <Br />
        The error message was:
        <Br />
        %(error)s""" % locals()
        return render_template('error.template', error_message=error_message,
            error_tepe="connection error")

    return render_template('tac.template', service_stats=service_stats, 
    host_stats=host_stats )