{% load nagios %}

<div class="card">
    <h5 class="card-header">Nagios</h5>
    <div class="card-body">
        <table class="table table-hover attr-table">
            <tr>
                <td>
                    <a href='{{ nagios_base_url }}status.cgi?host={{ object.name }}' target="_blank">
                        <span class="mdi mdi-server-network" aria-hidden="true"></span> Host Status
                    </a>
                </td>
                <td><span class="badge bg-{{ nagios.state|nagios_status_color }}">{{ nagios.state|nagios_status_string }}</span></td>
                <td></td>
            </tr>
            {% for service in nagios.services_with_info %}
            <tr>
                <td><a href='{{ nagios_base_url }}extinfo.cgi?type=2&host={{ object.name }}&service={{ service.0 }}' target="_blank">{{ service.0 }}</a></td>
                <td><span class="badge bg-{{ service.1|nagios_status_color }}">{{ service.1|nagios_status_string }}</span></td>
                <td>{{ service.3 }}</td>
            </tr>
            {% endfor %}
        </table>
    </div>
</div>
