feat: ping/DNS status and latency in hosts list and dashboard summary

This commit is contained in:
2026-03-18 23:09:49 -04:00
parent c26552b670
commit 791af2d58f
4 changed files with 181 additions and 27 deletions
+42 -5
View File
@@ -13,19 +13,56 @@
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Name</th>
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Address</th>
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Probe</th>
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Monitors</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Ping</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Latency</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">DNS</th>
<th style="padding:0.75rem 1rem;"></th>
</tr>
</thead>
<tbody>
{% for host in hosts %}
{% set ping = latest_pings.get(host.id) %}
{% set dns = latest_dns.get(host.id) %}
<tr style="border-bottom:1px solid #1a1a3a;">
<td style="padding:0.75rem 1rem;">{{ host.name }}</td>
<td style="padding:0.75rem 1rem;color:#a0a0c0;">{{ host.address }}</td>
<td style="padding:0.75rem 1rem;color:#a0a0c0;">{{ host.probe_type.value | upper }}:{{ host.probe_port }}</td>
<td style="padding:0.75rem 1rem;color:#a0a0c0;">
{% if host.ping_enabled %}<span style="color:#60c060;">ping</span>{% endif %}
{% if host.dns_enabled %}<span style="color:#6090c0;margin-left:0.5rem;">dns</span>{% endif %}
<td style="padding:0.75rem 1rem;color:#a0a0c0;font-size:0.85rem;">
{{ host.probe_type.value | upper }}{% if host.probe_type.value == 'tcp' %}:{{ host.probe_port }}{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;">
{% if not host.ping_enabled %}
<span style="color:#404060;font-size:0.8rem;">off</span>
{% elif ping is none %}
<span style="color:#606080;font-size:0.8rem;"></span>
{% elif ping.status.value == 'up' %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#40c040;" title="Up"></span>
{% else %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#c04040;" title="Down"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;font-size:0.9rem;">
{% if ping and ping.response_time_ms is not none %}
{% if ping.response_time_ms < 10 %}
<span style="color:#40c040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% elif ping.response_time_ms < 100 %}
<span style="color:#c0c040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% else %}
<span style="color:#c08040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% endif %}
{% else %}
<span style="color:#404060;"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;">
{% if not host.dns_enabled %}
<span style="color:#404060;font-size:0.8rem;">off</span>
{% elif dns is none %}
<span style="color:#606080;font-size:0.8rem;"></span>
{% elif dns.status.value == 'resolved' %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#40c040;" title="{{ dns.resolved_ip }}"></span>
{% else %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#c04040;" title="Failed"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:right;">
<a href="/hosts/{{ host.id }}/edit" style="color:#a0a0ff;margin-right:1rem;">Edit</a>